def read_file(filename, default=None):
    """
    Read the contents of a file, returning default if the file cannot be read.

    :param filename: name of file to read
    :type filename: str
    :param default: value to return if file cannot be read
    :return: contents of the file or default
    """
    contents = default
    try:
        fh = open(filename, "r", encoding="latin-1")
        try:
            contents = fh.read()
        finally:
            fh.close()
    except EnvironmentError:
        pass
    return contents