docs: def set_buffer(self, treebuffer,
                     branches=None,
                     ignore_branches=None,
                     create_branches=False,
                     visible=True,
                     ignore_missing=False,
                     ignore_duplicates=False,
                     transfer_objects=False):
          """
          Set the Tree buffer
  
          Parameters
          ----------
          treebuffer : rootpy.tree.buffer.TreeBuffer
              a TreeBuffer
  
          branches : list, optional (default=None)
              only include these branches from the TreeBuffer
  
          ignore_branches : list, optional (default=None)
              ignore these branches from the TreeBuffer
  
          create_branches : bool, optional (default=False)
              If True then the branches in the TreeBuffer should be created.
              Use this option if initializing the Tree. A ValueError is raised
              if an attempt is made to create a branch with the same name as one
              that already exists in the Tree. If False the addresses of existing
              branches will be set to point at the addresses in this buffer.
  
          visible : bool, optional (default=True)
              If True then the branches will be added to the buffer and will be
              accessible as attributes of the Tree.
  
          ignore_missing : bool, optional (default=False)
              If True then any branches in this buffer that do not exist in the
              Tree will be ignored, otherwise a ValueError will be raised. This
              option is only valid when ``create_branches`` is False.
  
          ignore_duplicates : bool, optional (default=False)
              If False then raise a ValueError if the tree already has a branch
              with the same name as an entry in the buffer. If True then skip
              branches that already exist. This option is only valid when
              ``create_branches`` is True.
  
          transfer_objects : bool, optional (default=False)
              If True, all tree objects and collections will be transferred from
              the buffer into this Tree's buffer.
          """
          # determine branches to keep while preserving branch order
          if branches is None:
              branches = treebuffer.keys()
          if ignore_branches is not None:
              branches = [b for b in branches if b not in ignore_branches]
  
          if create_branches:
              for name in branches:
                  value = treebuffer[name]
                  if self.has_branch(name):
                      if ignore_duplicates:
                          log.warning(
                              "Skipping entry in buffer with the same name "
                              "as an existing branch: `{0}`".format(name))
                          continue
                      raise ValueError(
                          "Attempting to create two branches "
                          "with the same name: `{0}`".format(name))
                  if isinstance(value, Scalar):
                      self.Branch(name, value,
                          '{0}/{1}'.format(
                              name, value.type))
                  elif isinstance(value, Array):
                      length = value.length_name or len(value)
                      self.Branch(name, value,
                          '{0}[{2}]/{1}'.format(
                              name, value.type, length))
                  else:
                      self.Branch(name, value)
          else:
              for name in branches:
                  value = treebuffer[name]
                  if self.has_branch(name):
                      self.SetBranchAddress(name, value)
                  elif not ignore_missing:
                      raise ValueError(
                          "Attempting to set address for "
                          "branch `{0}` which does not exist".format(name))
                  else:
                      log.warning(
                          "Skipping entry in buffer for which no "
                          "corresponding branch in the "
                          "tree exists: `{0}`".format(name))
          if visible:
              newbuffer = TreeBuffer()
              for branch in branches:
                  if branch in treebuffer:
                      newbuffer[branch] = treebuffer[branch]
              newbuffer.set_objects(treebuffer)
              self.update_buffer(newbuffer, transfer_objects=transfer_objects)