def METHOD_NAME(filename, string):
    try:
        with open(filename, "r") as f:
            for line in f:
                if string in line:
                    return True
    except OSError as ex:
        sys.stderr.write("Failed to read file '%s': %s\n"
                         % (filename, str(ex)))
    except ValueError as ex:
        sys.stderr.write("Invalid data in file '%s': %s\n"
                         % (filename, str(ex)))
    return False