'Returns a boolean (port_security_enabled).
Port_security is the value associated with the port if one is present
otherwise the value associated with the network is returned.'

def _determine_port_security(self, context, port):

    if (port.get('device_owner') and net.is_port_trusted(port)):
        return False
    if validators.is_attr_set(port.get(psec.PORTSECURITY)):
        port_security_enabled = port[psec.PORTSECURITY]
    else:
        port_security_enabled = self._get_network_security_binding(context, port['network_id'])
    return port_security_enabled
