def get_file_list(directory, exclude_patterns=None):
    """
    Recurisvely retrieve a list of files in the provided directory.

    :param directory: Path to directory to retrieve the file list for.
    :type directory: ``str``

    :param exclude_patterns: A list of `fnmatch` compatible patterns of files to exclude from
                             the result.
     :type exclude_patterns: ``list``

    :return: List of files in the provided directory. Each file path is relative
             to the provided directory.
    :rtype: ``list``
    """
    result = []
    if not directory.endswith("/"):
        # Make sure trailing slash is present
        directory = directory + "/"

    def include_file(file_path):
        if not exclude_patterns:
            return True

        for exclude_pattern in exclude_patterns:
            if fnmatch.fnmatch(file_path, exclude_pattern):
                return False

        return True

    for (dirpath, dirnames, filenames) in os.walk(directory):
        base_path = dirpath.replace(directory, "")

        for filename in filenames:
            if base_path:
                file_path = os.path.join(base_path, filename)
            else:
                file_path = filename

            if include_file(file_path=file_path):
                result.append(file_path)

    return result

    Recurisvely retrieve a list of files in the provided directory.

    :param directory: Path to directory to retrieve the file list for.
    :type directory: ``str``

    :param exclude_patterns: A list of `fnmatch` compatible patterns of files to exclude from
                             the result.
     :type exclude_patterns: ``list``

    :return: List of files in the provided directory. Each file path is relative
             to the provided directory.
    :rtype: ``list``
    
st2common/st2common/util/file_system.py