code: def to_underscore(s):
      
      return re.sub(
              r'(?!^)([A-Z]+)',
              lambda m: "_{0}".format(m.group(1).lower()),
              re.sub(r'(?!^)([A-Z]{1}[a-z]{1})', lambda m: "_{0}".format(m.group(1).lower()), s)
          ).lower()
docs: Transform camel or pascal case to underscore separated string