import random


def testFile(mafFile, s, headers=None):
    """
    given a path to a maffile, a string containing the desired contents of
    the file and a list of different possible headers, pick one header at
    random and write the string to the file.
    """
    f = open(mafFile, 'w')
    if headers:
        header = random.choice(headers)
        f.write(header)
    else:
        header = ''
    f.write(s)
    f.close()
    return mafFile, header