docs: def _split_input_from_namespace(cls, app, namespace, entity_kind,
                                    shard_count):
      """Helper for _split_input_from_params.
  
      If there are not enough Entities to make all of the given shards, the
      returned list of KeyRanges will include Nones. The returned list will
      contain KeyRanges ordered lexographically with any Nones appearing at the
      end.
  
      Args:
        app: the app.
        namespace: the namespace.
        entity_kind: entity kind as string.
        shard_count: the number of shards.
  
      Returns:
        KeyRange objects.
      """
  
      raw_entity_kind = cls._get_raw_entity_kind(entity_kind)
      if shard_count == 1:
        # With one shard we don't need to calculate any splitpoints at all.
        return [key_range.KeyRange(namespace=namespace, _app=app)]
  
      ds_query = datastore.Query(kind=raw_entity_kind,
                                 namespace=namespace,
                                 _app=app,
                                 keys_only=True)
      ds_query.Order("__scatter__")
      random_keys = ds_query.Get(shard_count * cls._OVERSAMPLING_FACTOR)
  
      if not random_keys:
        # There are no entities with scatter property. We have no idea
        # how to split.
        return ([key_range.KeyRange(namespace=namespace, _app=app)] +
                [None] * (shard_count - 1))
  
      random_keys.sort()
  
      if len(random_keys) >= shard_count:
        # We've got a lot of scatter values. Sample them down.
        random_keys = cls._choose_split_points(random_keys, shard_count)
  
      # pylint: disable=redefined-outer-name
      key_ranges = []
  
      key_ranges.append(key_range.KeyRange(
          key_start=None,
          key_end=random_keys[0],
          direction=key_range.KeyRange.ASC,
          include_start=False,
          include_end=False,
          namespace=namespace,
          _app=app))
  
      for i in range(0, len(random_keys) - 1):
        key_ranges.append(key_range.KeyRange(
            key_start=random_keys[i],
            key_end=random_keys[i+1],
            direction=key_range.KeyRange.ASC,
            include_start=True,
            include_end=False,
            namespace=namespace,
            _app=app))
  
      key_ranges.append(key_range.KeyRange(
          key_start=random_keys[-1],
          key_end=None,
          direction=key_range.KeyRange.ASC,
          include_start=True,
          include_end=False,
          namespace=namespace,
          _app=app))
  
      if len(key_ranges) < shard_count:
        # We need to have as many shards as it was requested. Add some Nones.
        key_ranges += [None] * (shard_count - len(key_ranges))
  
      return key_ranges