docstr: Return the number of items in the tree.
docstr_tok: ["Return","the","number","of","items","in","the","tree","."]
code: def __len__(self):
      """Return the number of items in the tree."""
      # TODO - Should we return the number of items that have IDs
      # or just the number of items?
      # The number of items is more intuitive but returning the number
      # of IDs matches __iter__ better.
      length = 0
      if getattr(self, "children", None) is None:
          length = 0
      elif isinstance(self.children, Component):
          length = 1
          length += len(self.children)
      elif isinstance(self.children, (tuple, MutableSequence)):
          for c in self.children:
              length += 1
              if isinstance(c, Component):
                  length += len(c)
      else:
          # string or number
          length = 1
      return length
  
imports: import abc
  import collections
  import inspect
  import sys
  import uuid
  import random
  from .._utils import patch_collections_abc, stringify_id, OrderedSet
label_desc: Use image node_id 13 for calling the Component obj's underlying member method code with example usage: obj.__len__() and returns: length