parameters: (self, replacement, word, mustmatch)
return_statement: return Pattern(replacement).resolve('', stem)
docstring: Given a word, replace the current pattern with the replacement pattern, a la 'patsubst'
  
          @param mustmatch If true and this pattern doesn't match the word, throw a DataError. Otherwise
                           return word unchanged.
docstring_summary: Given a word, replace the current pattern with the replacement pattern, a la 'patsubst'
docstring_tokens: Given a word replace the current pattern with the replacement pattern a la patsubst
function: def subst(self, replacement, word, mustmatch):
          """
          Given a word, replace the current pattern with the replacement pattern, a la 'patsubst'
  
          @param mustmatch If true and this pattern doesn't match the word, throw a DataError. Otherwise
                           return word unchanged.
          """
          assert isinstance(replacement, str_type)
  
          stem = self.match(word)
          if stem is None:
              if mustmatch:
                  raise DataError("target '%s' doesn't match pattern" % (word,))
              return word
  
          if not self.ispattern():
              # if we're not a pattern, the replacement is not parsed as a pattern either
              return replacement
  
          return Pattern(replacement).resolve('', stem)
function_tokens: def subst ( self , replacement , word , mustmatch ) : assert isinstance ( replacement , str_type ) stem = self . match ( word ) if stem is None : if mustmatch : raise DataError ( "target '%s' doesn't match pattern" % ( word , ) ) return word if not self . ispattern ( ) : # if we're not a pattern, the replacement is not parsed as a pattern either return replacement return Pattern ( replacement ) . resolve ( '' , stem )