code: def parse_unit(item, group, slash):
      
      surface = item.group(group).replace('.', '')
      power = re.findall(r'\-?[0-9%s]+' % r.SUPERSCRIPTS, surface)
  
      if power:
          power = [r.UNI_SUPER[i] if i in r.UNI_SUPER else i for i
                   in power]
          power = ''.join(power)
          new_power = (-1 * int(power) if slash else int(power))
          surface = re.sub(r'\^?\-?[0-9%s]+' % r.SUPERSCRIPTS, '', surface)
  
      elif re.findall(r'\bcubed\b', surface):
          new_power = (-3 if slash else 3)
          surface = re.sub(r'\bcubed\b', '', surface).strip()
  
      elif re.findall(r'\bsquared\b', surface):
          new_power = (-2 if slash else 2)
          surface = re.sub(r'\bsquared\b', '', surface).strip()
  
      else:
          new_power = (-1 if slash else 1)
  
      return surface, new_power
docs: Parse surface and power from unit text.