import six


def find_interface_by_type(context, networktype):
    """
    Lookup an interface based on networktype.  This is only intended for
    platform interfaces that have only 1 such interface per node (i.e., oam,
    mgmt, cluster-host, pxeboot, bmc).
    """
    for ifname, iface in six.iteritems(context['interfaces']):
        for net_type in iface.networktypelist:
            if networktype == net_type:
                return iface