class_docstr: Decorator subclass for sockets
  
  Gets the context from other args.
class_docstr_tok: ["Decorator","subclass","for","sockets","Gets","the","context","from","other","args","."]
docstr: Find the ``zmq.Context`` from ``args`` and ``kwargs`` at call time.
  
  First, if there is an keyword argument named ``context`` and it is a
  ``zmq.Context`` instance , we will take it.
  
  Second, we check all the ``args``, take the first ``zmq.Context``
  instance.
  
  Finally, we will provide default Context -- ``zmq.Context.instance``
  
  :return: a ``zmq.Context`` instance
docstr_tok: ["Find","the","``","zmq.Context","``","from","``","args","``","and","``","kwargs","``","at","call","time",".","First",",","if","there","is","an","keyword","argument","named","``","context","``","and","it","is","a","``","zmq.Context","``","instance",",","we","will","take","it",".","Second",",","we","check","all","the","``","args","``",",","take","the","first","``","zmq.Context","``","instance",".","Finally",",","we","will","provide","default","Context","--","``","zmq.Context.instance","``",":","return",":","a","``","zmq.Context","``","instance"]
code: def _get_context(self, *args, **kwargs):
      """
      Find the ``zmq.Context`` from ``args`` and ``kwargs`` at call time.
  
      First, if there is an keyword argument named ``context`` and it is a
      ``zmq.Context`` instance , we will take it.
  
      Second, we check all the ``args``, take the first ``zmq.Context``
      instance.
  
      Finally, we will provide default Context -- ``zmq.Context.instance``
  
      :return: a ``zmq.Context`` instance
      """
      if self.context_name in kwargs:
          ctx = kwargs[self.context_name]
  
          if isinstance(ctx, zmq.Context):
              return ctx
  
      for arg in args:
          if isinstance(arg, zmq.Context):
              return arg
      # not specified by any decorator
      return zmq.Context.instance()
  
file_path: catboost/contrib/python/pyzmq/py3/zmq/decorators.py
imports: from functools import wraps
  import zmq
label_desc: Use image node_id 3 for calling the _SocketDecorator obj's underlying member method code with example usage: obj._get_context() and returns: zmq, ctx, arg