def validate_type(data, types):
    """
    Validate type are defined in types.db and matching data values
    """
    if data.type not in types:
        raise Exception(
            'Do not know how to handle type %s. Do you have all your types.db files configured?'
             % data.type)
    if len(data.values) != len(types[data.type]):
        raise Exception('Number values %s differ from types defined for %s' %
            (data.values, data.type))
