code: def normalize_name(name):
      
      if not name or not isinstance(name, basestring):
          raise ValueError('Can only normalize non-empty string names. Unexpected '+ repr(name))
  
      if len(name) > 1:
          name = name.lower()
      if name != '_' and '_' in name:
          name = name.replace('_', ' ')
  
      return canonical_names.get(name, name)
docs: Given a key name (e.g. "LEFT CONTROL"), clean up the string and convert to
      the canonical representation (e.g. "left ctrl") if one is known.