def convert(value, row):
    '''demstatex -> dstate
    
    Simple crosswalk conversion to convert demstatex into dsource. If demstatex is not present
    in the crosswalk add the value to a report showing frequency of all missing values.'''
    
    convert_key = crosswalk['final'].metadata.get_key(row, as_str=True)
    missing = crosswalk['final'].missing or 99
    unknown = crosswalk['final'].unknown or 99
    
    if not convert_key:
         return missing
    try:
        return crosswalk['final'].convert(convert_key)
    
    except ConvertError as e:
        log.write('dstate', [row['id'], row['rapstatex'], convert_key, e])
        
        return unknown