code: def strip_line_magic_v3(cls,line):
          
  
          matches = re.findall("run_line_magic\(([^]]+)", line)
          if matches and matches[0]: # This line contains the pattern
              match = matches[0]
              if match[-1] == ')':
                  match = match[:-1] # Just because the re way is hard
              magic_kind,stripped = eval(match)
          else:
              stripped = line
              magic_kind = ""
          return stripped,magic_kind
docs: strip_line_magic() implementation for Python 3