'Register a *function* in the toolbox under the name *alias*. You
may provide default arguments that will be passed automatically when
calling the registered function. Fixed arguments can then be overriden
at function call time.
:param alias: The name the operator will take in the toolbox. If the
alias already exist it will overwrite the the operator
already present.
:param function: The function to which refer the alias.
:param argument: One or more argument (and keyword argument) to pass
automatically to the registered function when called,
optional.
The following code block is an example of how the toolbox is used. ::
>>> def func(a, b, c=3):
...     print a, b, c
>>> tools = Toolbox()
>>> tools.register("myFunc", func, 2, c=4)
>>> tools.myFunc(3)
2 3 4
The registered function will be given the attributes :attr:`__name__`
set to the alias and :attr:`__doc__` set to the original function\'s
documentation. The :attr:`__dict__` attribute will also be updated
with the original function\'s instance dictionary, if any.'

def register(self, alias, function, *args, **kargs):

    pfunc = partial(function, *args, **kargs)
    pfunc.__name__ = alias
    pfunc.__doc__ = function.__doc__
    if (hasattr(function, '__dict__') and (not isinstance(function, type))):
        pfunc.__dict__.update(function.__dict__.copy())
    setattr(self, alias, pfunc)
