@staticmethod
def _to_timestamp(datetime):
    """convert datetime to unix timestamp in python2 compatible manner."""
    try:
        return datetime.timestamp()
    except AttributeError:
        return int(datetime.strftime('%s'))
