<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def main(testfiles=None, action=printer):

 """testfiles can be None, in which case the command line arguments are used as filenames.
 testfiles can be a string, in which case that file is parsed.
 testfiles can be a list.
 In all cases, the filenames will be globbed.
 If more than one file is parsed successfully, a dictionary of ParseResults is returned.
 Otherwise, a simple ParseResults is returned.
 """

    testfiles = get_filename_list(testfiles)
    print(testfiles)

    if action:
        for i in (simple_identifier, value, item_list):
            i.setParseAction(action)

    success = 0
    failures = []

    retval = {}
    for f in testfiles:
        try:
            retval[f] = object_definition.parseFile(f)
            success += 1
        except Exception:
            failures.append(f)

    if failures:
        print('\nfailed while processing %s' % ', '.join(failures))
    print('\nsucceeded on %d of %d files' %(success, len(testfiles)))

    if len(retval) == 1 and len(testfiles) == 1:
        # if only one file is parsed, return the parseResults directly
        return retval[list(retval.keys())[0]]

    # else, return a dictionary of parseResults
    return retval