@staticmethod
def _socket_to_fd(obj):
    """
        convert a socket-like object to a file descriptor
        """
    if hasattr(obj, 'fileno'):
        fd = obj.fileno()
    else:
        fd = obj
    return fd
