def get_interface(midonet_api, host_name, interface_name):
    """Returns an interface with the given name.

    Args:
        midonet_api: A MidonetApi instance
        host_name: A MidoNet host name.
        interface_name: An interface name.

        Returns:
            An interface if one is found with the specified host, otherwise
            None.
    """
    host = None
    for h in midonet_api.get_hosts():
        if h.get_id() == host_name: host = h
    # No matching host found. Return None.
    if not host: return None

    interface = None
    for i in host.get_interfaces():
        if i.get_name() == interface_name:
            interface = i
            break

    return interface