code: def normalise_string(string):
      
      string = (string.strip()).lower()
      return re.sub(r'\W+', '_', string)
docs: Strips trailing whitespace from string, lowercases it and replaces
          spaces with underscores