def int_uid(field, key):
    """
    sets the key to be used as uid field, which also makes sure that uid must be a number

    we require a field explicityl named "uid" which must contain unique numbers for each data entry

    example:
    your data objects all have the key "ID", which holds a number for each object

    using int_uid as a mapping function without params will rename the field to uid and make sure it only contains integers

    note: calling a mapping function without params looks generally like this:
    {
      ...
      'ID': [int_uid, {}]
      ...
    }
    """
    try:
        return {'uid': str(int(field))}
    except TypeError:
        if field is None:
            raise KeyError('uid field must not be None') from None
        raise
