def auto_complete_paths(current, completion_type):
directory, filename = os.path.split(current)<EOL>current_path = os.path.abspath(directory)<EOL>if not os.access(current_path, os.R_OK):<EOL><INDENT>return<EOL><DEDENT>filename = os.path.normcase(filename)<EOL>file_list = (x for x in os.listdir(current_path)<EOL>if os.path.normcase(x).startswith(filename))<EOL>for f in file_list:<EOL><INDENT>opt = os.path.join(current_path, f)<EOL>comp_file = os.path.normcase(os.path.join(directory, f))<EOL>if completion_type != '<STR_LIT>' and os.path.isfile(opt):<EOL><INDENT>yield comp_file<EOL><DEDENT>elif os.path.isdir(opt):<EOL><INDENT>yield os.path.join(comp_file, '<STR_LIT>')<EOL><DEDENT><DEDENT>
If ``completion_type`` is ``file`` or ``path``, list all regular files
    and directories starting with ``current``; otherwise only list directories
    starting with ``current``.

    :param current: The word to be completed
    :param completion_type: path completion type(`file`, `path` or `dir`)i
    :return: A generator of regular files and/or directories