import calendar


def to_timestamp(value):
    """Convert a datetime value to a Unix timestamp.

    Parameters
    ----------
    value: Type[datetime.datetime]
        The Python datetime to convert to a Unix timestamp

    Returns
    --------
    integer or `None`:
        Unix timestamp for the datetime value or `None`

    """
    try:
        return str(calendar.timegm(value.utctimetuple()))
    except (AttributeError, TypeError):
        return None