def get_charge_event_id(charge, charge_item=None):
    """
    Returns a formatted id for a charge (or a charge_item
    on that charge) that can be used as `event_id` in a `Transaction`.
    """
    substr = 'cha_%d/' % charge.id
    if charge_item:
        substr += '%d/' % charge_item.id
    return substr
