code: def _get_members(
      obj, traverse_bases=True, filter=default_filter, recursive=True
  ):
      """Retrieve the member attributes of a module or a class.
  
      The descriptor protocol is bypassed.
  
      Parameters
      ----------
      obj : module or class
          Object.
      traverse_bases : bool
          If the object is a class, the base classes are also traversed.
      filter : function
          Attributes for which the function returns ``False`` are skipped. The
          function needs to define two parameters: ``name``, the attribute name,
          and ``obj``, the attribute value. If ``None``, no attribute is skipped.
      recursive : bool
          ``True`` to search recursively through subclasses.
  
      Returns
      ------
      list of (name, value)
          A list of tuples each containing the name and the value of the
          attribute.
      """
      if filter is None:
          filter = _true
  
      out = []
      stack = collections.deque((obj,))
      while stack:
          obj = stack.popleft()
          if traverse_bases and inspect.isclass(obj):
              roots = [
                  base
                  for base in inspect.getmro(obj)
                  if base not in (type, object)
              ]
          else:
              roots = [obj]
  
          members = []
          seen = set()
          for root in roots:
              for name, value in _iteritems(
                  getattr(root, "__dict__", {})
              ):
                  if name not in seen and filter(name, value):
                      members.append((name, value))
  
                  seen.add(name)
  
          members = sorted(members)
          for _, value in members:
              if recursive and inspect.isclass(value):
                  stack.append(value)
  
          out.extend(members)
  
      return out
  
imports: import collections
  import copy
  import inspect
  import logging
  import pkgutil
  import sys
  import types
label_desc: Use image node_id 15 for calling a global function with example usage: _get_members(obj, traverse_bases, filter, recursive) and returns: out