def get_sub_event_id(subscription, use_charge=None):
    """
    Returns a formatted id for a subscription (or a use_charge
    on that subscription) that can be used as `event_id` in a `Transaction`.
    """
    substr = "sub_%d/" % subscription.id
    if use_charge:
        substr += "%d/" % use_charge.id
    return substr