##### SUMMARY

Move the remaining files needed by `ansible-test` into the `test/lib/ansible_test/` directory. This is required to implement: https://github.com/ansible/ansible/issues/59884

##### ISSUE TYPE

Feature Idea

##### COMPONENT NAME

ansible-test

"""
    :rtype: int
    """
    
    socket_fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    with contextlib.closing(socket_fd):
        socket_fd.bind(('', 0))
        return socket_fd.getsockname()[1]
def get_subclasses(class_type):  
    """Returns the set of types that are concrete subclasses of the given type."""
    subclasses = set()
    queue = [class_type]
    while queue:
        parent = queue.pop()
        for child in parent.__subclasses__():
            if child not in subclasses:
                if not inspect.isabstract(child):
                    subclasses.add(child)
                queue.append(child)
    return subclasses
def is_subdir(candidate_path, path):