from datetime import datetime


def generate_timestamp(dt=None):
    """Formats datetime object for storing in BigQuery. Uses current time by default. """
    dt = dt or datetime.now()
    return dt.strftime("%Y-%m-%d %H:%M:%S")