def register(self, bucket, name_or_func, func=None):
assert bucket in self, '<STR_LIT>' % bucket<EOL>if func is None and hasattr(name_or_func, '<STR_LIT>'):<EOL><INDENT>name = name_or_func.__name__<EOL>func = name_or_func<EOL><DEDENT>elif func:<EOL><INDENT>name = name_or_func<EOL><DEDENT>if name in self[bucket]:<EOL><INDENT>raise AlreadyRegistered('<STR_LIT>' % name)<EOL><DEDENT>self[bucket][name] = func<EOL>
Add a function to the registry by name