def _classname_to_internal_name(s):
 if (not s):
  return s
 while True:
  match = re.search('(?:Bib)?(?:La)?TeX', s)
  if match:
   s = s.replace(match.group(0), (match.group(0)[0] + match.group(0)[1:].lower()))
  else:
   break
 s = re.sub('(?<=[a-z])[A-Z]|(?<!^)[A-Z](?=[a-z])', '_\\g<0>', s).lower()
 if s.endswith('_plugin'):
  s = s[:(-7)]
 return s

def _classname_to_internal_name ( s ) : if ( not s ) : return s while True : match = re . search ( '(?:Bib)?(?:La)?TeX' , s ) if match : s = s . replace ( match . group ( 0 ) , ( match . group ( 0 ) [ 0 ] + match . group ( 0 ) [ 1 : ] . lower ( ) ) ) else : break s = re . sub ( '(?<=[a-z])[A-Z]|(?<!^)[A-Z](?=[a-z])' , '_\\g<0>' , s ) . lower ( ) if s . endswith ( '_plugin' ) : s = s [ : ( - 7 ) ] return s
converts a python class name in to an internal name the intention here is to mirror how st treats *command objects .