code: def attach(object, name):
      """Return a decorator doing ``setattr(object, name)`` with its argument.
  
      >>> spam = type('Spam', (object,), {})()
      >>> @attach(spam, 'eggs')
      ... def func():
      ...     pass
      >>> spam.eggs  # doctest: +ELLIPSIS
      <function func at 0x...>
      """
  
      def decorator(func):
          setattr(object, name, func)
          return func
  
      return decorator
  
imports: import os
  from .None import _compat
label_desc: Use image node_id 1 for calling a global function with example usage: attach(object, name) and returns: decorator, func