def access(path, mode, user=None):
scheme = parse(path)[<NUM_LIT:0>]<EOL>if scheme == '<STR_LIT:file>' or hdfs_fs.default_is_local():<EOL><INDENT>return os.access(path, mode)<EOL><DEDENT>if user is None:<EOL><INDENT>user = common.DEFAULT_USER<EOL><DEDENT>st = stat(path)<EOL>if st.st_uid == user:<EOL><INDENT>mode <<= <NUM_LIT:6><EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>groups = common.get_groups(user)<EOL><DEDENT>except KeyError:<EOL><INDENT>groups = []<EOL><DEDENT>if st.st_gid in groups:<EOL><INDENT>mode <<= <NUM_LIT:3><EOL><DEDENT><DEDENT>return (st.st_mode & mode) == mode<EOL>
Perform the equivalent of :func:`os.access` on ``path``.