code: def get_number_of_partitions_for(self, ar):
          
          # fetch the number of partitions from the request
          uid = api.get_uid(ar)
          num = self.request.get("primary", {}).get(uid)
  
          if num is None:
              # get the number of partitions from the template
              template = ar.getTemplate()
              if template:
                  num = len(template.getPartitions())
              else:
                  num = DEFAULT_NUMBER_OF_PARTITIONS
          try:
              num = int(num)
          except (TypeError, ValueError):
              num = DEFAULT_NUMBER_OF_PARTITIONS
          return num
docs: Return the number of selected partitions