def METHOD_NAME(fspath):
    """Given the path to the filesystem where a shell may exist, find the
    first available shell"""
    for sh in command_lib.command_lib['common']['shells']:
        realpath = os.path.realpath(os.path.join(fspath, sh[1:]))
        # If realpath is a symlink and points to the root of the container,
        # check for existence of the linked binary in current working dir
        if realpath[0] == '/' and os.path.exists(os.path.join(fspath,
                                                              realpath[1:])):
            return sh
        # In some cases, the realpath for a symlink incorrectly resolves to
        # /usr/<path>. In these cases, ignore the /usr/ prefix and look for
        # the linked binary in the current working dir.
        # See issue #1161 for details.
        if realpath[0] == '/' and os.path.exists(os.path.join(fspath,
                                                              realpath[5:])):
            return sh
        # otherwise, just follow symlink in same folder and
        # remove leading forwardslash before joining paths
        if os.path.exists(os.path.join(fspath, sh[1:])):
            return sh
    return ''