<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_file_metrics(context, file_processors):
 """Main routine for metrics."""

    file_metrics = OrderedDict()

    # TODO make available the includes and excludes feature
    gitignore = []
    if os.path.isfile('.gitignore'):
        with open('.gitignore', 'r') as ifile:
            gitignore = ifile.read().splitlines()

    in_files = glob_files(context['root_dir'], context['in_file_names'], gitignore=gitignore)
    # main loop
    for in_file, key in in_files:
        # print 'file %i: %s' % (i, in_file)
        try:
            with open(in_file, 'rb') as ifile:
                code = ifile.read()
            # lookup lexicographical scanner to use for this run
            try:
                lex = guess_lexer_for_filename(in_file, code, encoding='guess')
                # encoding is 'guess', chardet', 'utf-8'
            except:
                pass
            else:
                token_list = lex.get_tokens(code)  # parse code

                file_metrics[key] = OrderedDict()
                file_metrics[key].update(compute_file_metrics(file_processors, lex.name, key, token_list))
                file_metrics[key]['language'] = lex.name

        except IOError as e:
            sys.stderr.writelines(str(e) + " -- Skipping input file.\n\n")

    return file_metrics