code: def paths(obj, dirs=True, leaves=True, path=[], skip=False):
      
      if isinstance(obj, MutableMapping):
          # Python 3 support
          if PY3:
              iteritems = obj.items()
              string_class = str
          else: # Default to PY2
              iteritems = obj.iteritems()
              string_class = basestring
  
          for (k, v) in iteritems:
              if issubclass(k.__class__, (string_class)):
                  if (not k) and (not dpath.options.ALLOW_EMPTY_STRING_KEYS):
                      raise dpath.exceptions.InvalidKeyName("Empty string keys not allowed without "
                                                            "dpath.options.ALLOW_EMPTY_STRING_KEYS=True")
                  elif (skip and k[0] == '+'):
                      continue
              newpath = path + [[k, v.__class__]]
              validate(newpath)
              if dirs:
                  yield newpath
              for child in paths(v, dirs, leaves, newpath, skip):
                  yield child
      elif isinstance(obj, MutableSequence):
          for (i, v) in enumerate(obj):
              newpath = path + [[i, v.__class__]]
              if dirs:
                  yield newpath
              for child in paths(obj[i], dirs, leaves, newpath, skip):
                  yield child
      elif leaves:
          yield path + [[obj, obj.__class__]]
      elif not dirs:
          yield path
docs: Yield all paths of the object.
  
      Arguments:
  
      obj -- An object to get paths from.
  
      Keyword Arguments:
  
      dirs -- Yield intermediate paths.
      leaves -- Yield the paths with leaf objects.
      path -- A list of keys representing the path.
      skip -- Skip special keys beginning with '+'.