code: def delete(obj, glob, separator="/", afilter=None):
      
      deleted = 0
      paths = []
      globlist = __safe_path__(glob, separator)
      for path in _inner_search(obj, globlist, separator):
          # These are yielded back, don't mess up the dict.
          paths.append(path)
  
      for path in paths:
          cur = obj
          prev = None
          for item in path:
              prev = cur
              try:
                  cur = cur[item[0]]
              except AttributeError as e:
                  # This only happens when we delete X/Y and the next
                  # item in the paths is X/Y/Z
                  pass
          if (not afilter) or (afilter and afilter(prev[item[0]])):
              prev.pop(item[0])
          deleted += 1
      if not deleted:
          raise dpath.exceptions.PathNotFound("Could not find {0} to delete it".format(glob))
      return deleted
docs: Given a path glob, delete all elements that match the glob.
  
      Returns the number of deleted objects. Raises PathNotFound if no paths are
      found to delete.