def write(cal, file=None):
    """Write a calendar to an ICS file.

    Args:
        cal: calendar to write to the file
        file: file to write the calendar in

    """
    file.write(cal.to_ical().decode('utf-8'))
