code: def calculate_piece_size(self):
          
          size = self.size
          if not size:
              raise RuntimeError(f'Cannot calculate piece size with no "path" specified')
          else:
              self.metainfo['info']['piece length'] = utils.calc_piece_size(
                  size, self.MAX_PIECES, self.MIN_PIECE_SIZE, self.MAX_PIECE_SIZE)
docs: Calculate and add ``piece length`` to ``info`` in :attr:`metainfo`
  
          The piece size is calculated so that there are no more than
          :attr:`MAX_PIECES` pieces unless it is larger than
          :attr:`MAX_PIECE_SIZE`, in which case there is no limit on the number of
          pieces.
  
          :raises RuntimeError: if :attr:`size` returns ``None``