def _RecComputeRebalanceSize(mapping, server_id, dspath, subpath):
  """Recursively compute the size of files that need to be moved."""
  total = 0
  fulldir = utils.JoinPath(dspath, subpath)
  for comp in os.listdir(fulldir):
    if comp == constants.REBALANCE_DIRECTORY:
      continue
    # Real path name.
    path = utils.JoinPath(fulldir, comp)
    # Get basename and extension.
    name, unused_extension = os.path.splitext(comp)
    if COPY_EXCEPTIONS in name:
      logging.info("Skip %s", comp)
      continue
    if os.path.isdir(path):
      total += _RecComputeRebalanceSize(mapping, server_id, dspath,
                                        utils.JoinPath(subpath, comp))
    elif os.path.isfile(path):
      key = common.MakeDestinationKey(subpath, name)
      where = sutils.MapKeyToServer(mapping, key)
      if where != server_id:
        logging.info("Need to move %s from %d to %d", path, server_id, where)
        total += os.path.getsize(path)
      else:
        logging.info("File %s stays here", path)
  return total
dataset/ETHPy150Open google/grr/grr/server/data_server/rebalance.py/_RecComputeRebalanceSize/swapped operands of `in`