def get_invoice(trip):
    """
    Returns the invoice of the trip
    :param trip: Object
    :return: String containing invoice
    """
    invoice = ''
    if 'invoice' in trip.keys():
        invoice = trip['invoice']
        if invoice != '':
            return invoice
    if invoice == '' and 'jobs' in trip.keys():
        try:
            invoice = trip['jobs']
        except KeyError as e:
            invoice = ''
    else:
        invoice = ''
    if invoice == '':
        if 'ShipmentId' in trip.keys():
            invoice = trip['ShipmentId']
        if invoice == '':
            if 'lr_number' in trip.keys():
                invoice = trip['lr_number']
    return invoice
