def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    else:  # pragma: no cover
        try:
            return socket.AddressType(num)
        except (__HOLE__, AttributeError):
            return num
dataset/ETHPy150Open giampaolo/psutil/psutil/_common.py/socktype_to_enum