@classmethod
def create_floatingip(cls, external_network_id=None, port=None, client=None,
    **kwargs):
    """Creates a floating IP.

        Create a floating IP and schedule it for later deletion.
        If a client is passed, then it is used for deleting the IP too.

        :param external_network_id: network ID where to create
        By default this is 'CONF.network.public_network_id'.

        :param port: port to bind floating IP to
        This is translated to 'port_id=port['id']'
        By default it is None.

        :param client: network client to be used for creating and cleaning up
        the floating IP.

        :param **kwargs: additional creation parameters to be forwarded to
        networking server.
        """
    client = client or cls.client
    external_network_id = external_network_id or cls.external_network_id
    if port:
        port_id = kwargs.setdefault('port_id', port['id'])
        if port_id != port['id']:
            message = 'Port ID specified twice: {!s} != {!s}'.format(port_id,
                port['id'])
            raise ValueError(message)
    fip = client.create_floatingip(external_network_id, **kwargs)['floatingip']
    fip['client'] = client
    cls.floating_ips.append(fip)
    return fip
