def get_file_list(directory, exclude_patterns=None):
    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
Returns the hostname for a (server, version, instance) tuple.
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/util/file_system.py/get_file_list--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/request_info.py/Dispatcher.get_hostname