def interface_to_ip(interface):
    """
    Gets the IPv4 address from a `net_if_addrs` interface record.
    The record is passed as a `snic` `namedtuple`.
    This function locates the IPv4 one and returns it.
    """
    for record in interface:
        if record.family == 2:  # AF_INET
            return record.address

    return None