'Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing.'

def parseFile(self, file_or_filename):

    try:
        file_contents = file_or_filename.read()
    except AttributeError:
        f = open(file_or_filename, 'rb')
        file_contents = f.read()
        f.close()
    return self.parseString(file_contents)
