def convert_qty2gram(qty = {'val': '', 'unit': ''}):
    """
    Convert OFF quantity to a standard quantity (in grams)
    Args:
        qty (dict): OFF quantity value and unit
    Returns:
        dict with value converted to grams (if possible) and
        two new keys:
           std: True if value could be converted using a standard 
                conversion factor
           approx: True if the original units were not in 'g', 'kg', 'mg'
    """
    init_val = qty['val']
    init_unit = qty['unit']

    convert_matrix = {'g':1.0,
                      'kg':1000,
                      'mg':0.001,
                      'gal':3785.41,
                      'egg':50.0,              # TO BE VALIDATED
                      'portion':100.0,         # TO BE VALIDATED
                      'l':1000.0,
                      'ml':1.0,
                      'cl':10.0,
                      'dl':100.0,
                      'oz':28.3495,
                      'lb':453.592}
    if (init_val!='') & (init_unit in convert_matrix.keys()):
        conv_val = convert_matrix[init_unit]*init_val
        conv_unit = 'g'
        conv_std = True
    else:
        conv_val = init_val
        conv_unit = init_unit
        conv_std = False

    # all conversions not from g, kg or mg are approximate conversions
    approx = True
    if init_unit in ['g', 'kg', 'mg']:
        approx = False

    return {'val': conv_val, 'unit': conv_unit, 'std': conv_std, 'approx': approx}