<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getTemplates(fnames, blend=True):
 """ Process all headers to produce a set of combined headers that follows the rules defined by each instrument. """

    if not blend:
        newhdrs =  blendheaders.getSingleTemplate(fnames[0])
        newtab = None
    else:
        # apply rules to create final version of headers, plus table
        newhdrs, newtab = blendheaders.get_blended_headers(inputs=fnames)

    cleanTemplates(newhdrs[1],newhdrs[2],newhdrs[3])

    return newhdrs, newtab