def write(path, contents, open_flags='w'):
    """Opens file at |path| with |open_flags| and writes |contents| to it."""
    with open(path, open_flags) as file_handle:
        return file_handle.write(contents)