Return the contents of the text file at path.
    If it is a binary file,raise an IOError

def get_file_contents(path, binary=False):
    """
    Return the contents of the text file at path.
    If it is a binary file,raise an IOError
    """
    # if this isn't a text file, we should raise an IOError
    f = open(path, 'r')
    file_contents = f.read()
    f.close()
    if not binary and file_contents.find('\000') >= 0:
        raise IOError('Expected text file, got binary file')
    return file_contents