def list_files(root, suffix, prefix=False):
root = os.path.expanduser(root)<EOL>files = list(<EOL>filter(<EOL>lambda p: os.path.isfile(os.path.join(root, p)) and p.endswith(suffix),<EOL>os.listdir(root)<EOL>)<EOL>)<EOL>if prefix is True:<EOL><INDENT>files = [os.path.join(root, d) for d in files]<EOL><DEDENT>return files<EOL>
List all files ending with a suffix at a given root

    Args:
        root (str): Path to directory whose folders need to be listed
        suffix (str or tuple): Suffix of the files to match, e.g. '.png' or ('.jpg', '.png').
            It uses the Python "str.endswith" method and is passed directly
        prefix (bool, optional): If true, prepends the path to each result, otherwise
            only returns the name of the files found