code: def rebalance(self, weight, child, base=np.nan, update=True):
          
          # if weight is 0 - we want to close child
          if weight == 0:
              if child in self.children:
                  return self.close(child)
              else:
                  return
  
          # if no base specified use self's value
          if np.isnan(base):
              base = self.value
  
          # else make sure we have child
          if child not in self.children:
              c = SecurityBase(child)
              c.setup(self._universe)
              # update child to bring up to speed
              c.update(self.now)
              self._add_child(c)
  
          # allocate to child
          # figure out weight delta
          c = self.children[child]
          delta = weight - c.weight
          c.allocate(delta * base)
docs: Rebalance a child to a given weight.
  
          This is a helper method to simplify code logic. This method is used
          when we want to se the weight of a particular child to a set amount.
          It is similar to allocate, but it calculates the appropriate allocation
          based on the current weight.
  
          Args:
              * weight (float): The target weight. Usually between -1.0 and 1.0.
              * child (str): child to allocate to - specified by name.
              * base (float): If specified, this is the base amount all weight
                  delta calculations will be based off of. This is useful when we
                  determine a set of weights and want to rebalance each child
                  given these new weights. However, as we iterate through each
                  child and call this method, the base (which is by default the
                  current value) will change. Therefore, we can set this base to
                  the original value before the iteration to ensure the proper
                  allocations are made.
              * update (bool): Force update?