code: def replace_grist (features, new_grist):
      
      assert is_iterable_typed(features, basestring) or isinstance(features, basestring)
      assert isinstance(new_grist, basestring)
      # this function is used a lot in the build phase and the original implementation
      # was extremely slow; thus some of the weird-looking optimizations for this function.
      single_item = False
      if isinstance(features, str):
          features = [features]
          single_item = True
  
      result = []
      for feature in features:
          # '<feature>value' -> ('<feature', '>', 'value')
          # 'something' -> ('something', '', '')
          # '<toolset>msvc/<feature>value' -> ('<toolset', '>', 'msvc/<feature>value')
          grist, split, value = feature.partition('>')
          # if a partition didn't occur, then grist is just 'something'
          # set the value to be the grist
          if not value and not split:
              value = grist
          result.append(new_grist + value)
  
      if single_item:
          return result[0]
      return result
docs: Replaces the grist of a string by a new one.
          Returns the string with the new grist.