code: def asdict(
      inst,
      recurse=True,
      filter=None,
      dict_factory=dict,
      retain_collection_types=False,
      value_serializer=None,
  ):
      """
      Return the ``attrs`` attribute values of *inst* as a dict.
  
      Optionally recurse into other ``attrs``-decorated classes.
  
      :param inst: Instance of an ``attrs``-decorated class.
      :param bool recurse: Recurse into classes that are also
          ``attrs``-decorated.
      :param callable filter: A callable whose return code determines whether an
          attribute or element is included (``True``) or dropped (``False``).  Is
          called with the `attr.Attribute` as the first argument and the
          value as the second argument.
      :param callable dict_factory: A callable to produce dictionaries from.  For
          example, to produce ordered dictionaries instead of normal Python
          dictionaries, pass in ``collections.OrderedDict``.
      :param bool retain_collection_types: Do not convert to ``list`` when
          encountering an attribute whose type is ``tuple`` or ``set``.  Only
          meaningful if ``recurse`` is ``True``.
      :param Optional[callable] value_serializer: A hook that is called for every
          attribute or dict key/value.  It receives the current instance, field
          and value and must return the (updated) value.  The hook is run *after*
          the optional *filter* has been applied.
  
      :rtype: return type of *dict_factory*
  
      :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
          class.
  
      ..  versionadded:: 16.0.0 *dict_factory*
      ..  versionadded:: 16.1.0 *retain_collection_types*
      ..  versionadded:: 20.3.0 *value_serializer*
      """
      attrs = fields(inst.__class__)
      rv = dict_factory()
      for a in attrs:
          v = getattr(inst, a.name)
          if filter is not None and not filter(a, v):
              continue
  
          if value_serializer is not None:
              v = value_serializer(inst, a, v)
  
          if recurse is True:
              if has(v.__class__):
                  rv[a.name] = asdict(
                      v,
                      True,
                      filter,
                      dict_factory,
                      retain_collection_types,
                      value_serializer,
                  )
              elif isinstance(v, (tuple, list, set, frozenset)):
                  cf = (
                      v.__class__
                      if retain_collection_types is True
                      else list
                  )
                  rv[a.name] = cf(
                      [
                          _asdict_anything(
                              i,
                              filter,
                              dict_factory,
                              retain_collection_types,
                              value_serializer,
                          )
                          for i in v
                      ]
                  )
              elif isinstance(v, dict):
                  df = dict_factory
                  rv[a.name] = df(
                      (
                          _asdict_anything(
                              kk,
                              filter,
                              df,
                              retain_collection_types,
                              value_serializer,
                          ),
                          _asdict_anything(
                              vv,
                              filter,
                              df,
                              retain_collection_types,
                              value_serializer,
                          ),
                      )
                      for kk, vv in iteritems(v)
                  )
              else:
                  rv[a.name] = v
          else:
              rv[a.name] = v
      return rv
  
file_path: catboost/contrib/python/attrs/py2/attr/_funcs.py
imports: from __future__ import absolute_import, division, print_function
  import copy
  from ._compat import iteritems
  from ._make import NOTHING, _obj_setattr, fields
  from .exceptions import AttrsAttributeNotFoundError
label_desc: Use image node_id 1 for calling a global function with example usage: asdict(inst, recurse, filter, dict_factory, retain_collection_types, value_serializer) and returns: rv