def observeElements(self, what, call=None):
def _observe(call):<EOL><INDENT>self.__observers.add(what, call)<EOL>return call<EOL><DEDENT>toEvaluate = []<EOL>if isinstance(what, str):<EOL><INDENT>toEvaluate.append(what)<EOL><DEDENT>else:<EOL><INDENT>toEvaluate = what<EOL><DEDENT>if not self.areObservableElements(toEvaluate):<EOL><INDENT>msg = '<STR_LIT>'<EOL>raise ValueError(msg.format(what, self.__class__))<EOL><DEDENT>if call is not None:<EOL><INDENT>return _observe(call)<EOL><DEDENT>else:<EOL><INDENT>return _observe<EOL><DEDENT>
Registers an observer function to a specific state field or
    list of state fields.
    The function to call should have 2 parameters:
    - previousValue,
    -actualValue

:param what: name of the state field or names of the
             state field to observe.
:type what: str | array
:param func call: The function to call. When not given,
                  decorator usage is assumed.
:return: the function to call once state change.
:rtype: func
:raises TypeError: if the called function is not callable

=================
How to use it
=================
-----------------
1. Calling the function
-----------------
.. code-block:: python
    instance.observeFields("FieldName", functionName)
    instance.observeFields(["FieldName1","FieldName2"], functionName)

    ...
    def functionName(previousState, actualState):

-----------------
2. Using Decoration
-----------------
.. code-block:: python
    @instance.observeFields("FieldName")
    def functionName(previousValue, actualValue):

    @instance.observeFields(["FieldName1","FieldName2"])
    def functionName(previousValue, actualValue):