def find_files(path, patterns):
if not isinstance(patterns, (list, tuple)):<EOL><INDENT>patterns = [patterns]<EOL><DEDENT>matches = []<EOL>for root, dirnames, filenames in os.walk(path):<EOL><INDENT>for pattern in patterns:<EOL><INDENT>for filename in fnmatch.filter(filenames, pattern):<EOL><INDENT>matches.append(os.path.join(root, filename))<EOL><DEDENT><DEDENT><DEDENT>return matches<EOL>
Returns all files from a given path that matches the pattern or list
of patterns

@type path: str
@param path: A path to traverse

@typ patterns: str|list
@param patterns: A pattern or a list of patterns to match

@rtype: list[str]:
@return: A list of matched files