def get_mixed_type_key(obj):
if isinstance(obj, _BaseNetwork):<EOL><INDENT>return obj._get_networks_key()<EOL><DEDENT>elif isinstance(obj, _BaseAddress):<EOL><INDENT>return obj._get_address_key()<EOL><DEDENT>return NotImplemented<EOL>
Return a key suitable for sorting between networks and addresses.

    Address and Network objects are not sortable by default; they're
    fundamentally different so the expression

        IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')

    doesn't make any sense.  There are some times however, where you may wish
    to have ipaddress sort these for you anyway. If you need to do this, you
    can use this function as the key= argument to sorted().

    Args:
      obj: either a Network or Address object.
    Returns:
      appropriate key.