def write_file(path, data, mode='w'):
    """Write data to a file.

    Args:
        path (str): path to the file.
        data (str): data to be written to the file.
        mode (str): mode which the file will be open.

    """
    with open(path, mode) as f:
        f.write(data)
