def objectCheck(definitions, obj):
    """ Checks that object has certain attributes, according to definitions
  
  :param definitions: Dictionary defining the parameters and their types (obj should have at least these attributes)
  :param obj:         Object to be checked
  
  An example definitions dictionary:
  
  |{
  |"age"     : int,         # must have attribute age that is an integer
  |"name"    : str,         # must have attribute name that is a string            
  | }
  """
    for key in definitions:
        required_type = definitions[key]
        attr = getattr(obj, key)
        if attr.__class__ != required_type:
            raise AttributeError('Wrong type of parameter ' + key +
                ' : should be ' + required_type.__name__)
            return False
    return True
