'Add monitoring to a given field or Attribute. A field must
be specified with the full db_* name or it will be assumed
to be an Attribute (so `db_key`, not just `key`).
Args:
obj (Typeclassed Entity): The entity on which to monitor a
field or Attribute.
fieldname (str): Name of field (db_*) or Attribute to monitor.
callback (callable): A callable on the form `callable(**kwargs),
where kwargs holds keys fieldname and obj.
idstring (str, optional): An id to separate this monitor from other monitors
of the same field and object.
persistent (bool, optional): If False, the monitor will survive
a server reload but not a cold restart. This is default.
Kwargs:
session (Session): If this keyword is given, the monitorhandler will
correctly analyze it and remove the monitor if after a reload/reboot
the session is no longer valid.
any (any): Any other kwargs are passed on to the callback. Remember that
all kwargs must be possible to pickle!'

def add(self, obj, fieldname, callback, idstring='', persistent=False, **kwargs):

    if ((not fieldname.startswith('db_')) or (not hasattr(obj, fieldname))):
        obj = obj.attributes.get(fieldname, return_obj=True)
        if (not obj):
            return
        fieldname = 'db_value'
    try:
        if (not inspect.isfunction(callback)):
            raise TypeError('callback    is    not    a    function.')
        dbserialize((obj, fieldname, callback, idstring, persistent, kwargs))
    except Exception:
        err = ('Invalid    monitor    definition:    \n    (%s,    %s,    %s,    %s,    %s,    %s)' % (obj, fieldname, callback, idstring, persistent, kwargs))
        logger.log_trace(err)
    else:
        self.monitors[obj][fieldname][idstring] = (callback, persistent, kwargs)
