def get_next_ip(self, tenant_id, direc):
<EOL>if direc == '<STR_LIT>':<EOL><INDENT>subnet_dict = self.get_in_ip_addr(tenant_id)<EOL><DEDENT>else:<EOL><INDENT>subnet_dict = self.get_out_ip_addr(tenant_id)<EOL><DEDENT>if subnet_dict:<EOL><INDENT>return subnet_dict<EOL><DEDENT>if direc == '<STR_LIT>':<EOL><INDENT>ip_next = self.check_allocate_ip(self.service_in_ip, "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>ip_next = self.check_allocate_ip(self.service_out_ip, "<STR_LIT>")<EOL><DEDENT>return {'<STR_LIT>': ip_next, '<STR_LIT:start>': self.get_start_ip(ip_next),<EOL>'<STR_LIT:end>': self.get_end_ip(ip_next),<EOL>'<STR_LIT>': self.get_gateway(ip_next),<EOL>'<STR_LIT>': self.get_secondary_gateway(ip_next)}<EOL>
Retrieve the next available subnet.

        Given a tenant, it returns the service subnet values assigned
        to it based on direction.