def expose(self, key=None):
def decorator(function):<EOL><INDENT>rkey = key<EOL>if rkey is None:<EOL><INDENT>if isinstance(function, FunctionType):<EOL><INDENT>rkey = function.__name__<EOL><DEDENT>else:<EOL><INDENT>raise NameRequired()<EOL><DEDENT><DEDENT>if rkey not in self._exposed:<EOL><INDENT>self._exposed[rkey] = []<EOL><DEDENT>self._exposed[rkey].append(function)<EOL>return function<EOL><DEDENT>return decorator<EOL>
Expose the decorated method for this L{Exposer} with the given key.  A
method which is exposed will be able to be retrieved by this
L{Exposer}'s C{get} method with that key.  If no key is provided, the
key is the method name of the exposed method.

Use like so::

    class MyClass:
        @someExposer.expose()
        def foo(): ...

or::

    class MyClass:
        @someExposer.expose('foo')
        def unrelatedMethodName(): ...

@param key: a hashable object, used by L{Exposer.get} to look up the
decorated method later.  If None, the key is the exposed method's name.

@return: a 1-argument callable which records its input as exposed, then
returns it.