'Unbind the given ports by clearing their device_id and
device_owner.
:param context: The request context.
:param ports: list of port IDs.
:param neutron: neutron client for the current context.
:param port_client: The client with appropriate karma for
updating the ports.'

def _unbind_ports(self, context, ports, neutron, port_client=None):

    port_binding = self._has_port_binding_extension(context, refresh_cache=True, neutron=neutron)
    if (port_client is None):
        port_client = (neutron if (not port_binding) else get_client(context, admin=True))
    for port_id in ports:
        if (port_id is None):
            continue
        port_req_body = {'port': {'device_id': '', 'device_owner': ''}}
        if port_binding:
            port_req_body['port'][BINDING_HOST_ID] = None
            port_req_body['port'][BINDING_PROFILE] = {}
        if (constants.DNS_INTEGRATION in self.extensions):
            port_req_body['port']['dns_name'] = ''
        try:
            port_client.update_port(port_id, port_req_body)
        except neutron_client_exc.PortNotFoundClient:
            LOG.debug('Unable    to    unbind    port    %s    as    it    no    longer    exists.', port_id)
        except Exception:
            LOG.exception(_LE("Unable    to    clear    device    ID    for    port    '%s'"), port_id)
