import calendar


def to_timestamp(date):
    """Convert a datetime object into a calendar timestamp object

    Parameters
    ----------
    date : datetime.datetime
        Datetime object e.g. datetime.datetime(2020, 10, 31, 0, 0)

    Returns
    -------
    cal : calendar.timegm
        Calendar timestamp corresponding to the input datetime
    """
    return calendar.timegm(date.timetuple())