def METHOD_NAME(interface):
    """Given an interface name, returns the CPU affinity
    for that interface if available, otherwise
    returns None.
    PORT: This only works on linux. A good todo might be
    to figure out if it could work on other platforms, but
    given the nature of high speed networking it seems
    like it might not be a big deal.
    """
    # if it's a sub interface, we have to look up the 'main'
    # interface for affinity detection
    match = re.search(r'(.+)\.\d+$', interface)
    if match:
        interface = match.groups()[0]
    filename = "/sys/class/net/%s/device/numa_node" % interface
    if not os.path.exists(filename):
        return None
    with open(filename, 'r') as numa_file:
        affinity = numa_file.read().rstrip()
        # This is the same as no affinity, so make calling
        # functions not care
        if affinity == "-1":
            return None
        return affinity
    return None