def sockfam_to_enum(num):
 if (enum is None):
  return num
 else:
  try:
   return socket.AddressFamily(num)
  except (ValueError, AttributeError):
   return num

def sockfam_to_enum ( num ) : if ( enum is None ) : return num else : try : return socket . AddressFamily ( num ) except ( ValueError , AttributeError ) : return num
convert a numeric socket family value to an intenum member .