@classmethod<EOL><INDENT>def bind(cls, param=None, **kwargs):<DEDENT>
def stick(function, **binding):<EOL><INDENT>if not asyncio.iscoroutine(function):<EOL><INDENT>function = asyncio.coroutine(function)<EOL><DEDENT>bindings = getattr(function, STICKER, [])<EOL>bindings.append(binding)<EOL>setattr(function, STICKER, bindings)<EOL>return function<EOL><DEDENT>if isinstance(param, str):<EOL><INDENT>return partial(stick, prefix=param, **kwargs)<EOL><DEDENT>return stick(param, **kwargs)<EOL>
Bind middleware's method as endpoint.