original_docstring: 
          Create an iframe embedding the pythontutor.com page
          with the code included in the code cell::
  
          In [1]: %%tutor -l 'python3'
          ....: a = 1
          ....: b = 1
          ....: a + b
  
          [You will see an iframe with the pythontutor.com page including the 
          code above]
          
docstring: Create an iframe embedding the pythontutor.com page
  with the code included in the code cell:.
  
  
  
  [You will see an iframe with the pythontutor.com page including the
  code above]
docstring_tokens: Create an iframe embedding the pythontutor . com page with the code included in the code cell : . [ You will see an iframe with the pythontutor . com page including the code above ]
code: def tutor(self, line, cell=None, local_ns=None):
          '''
          Create an iframe embedding the pythontutor.com page
          with the code included in the code cell::
  
          In [1]: %%tutor -l 'python3'
          ....: a = 1
          ....: b = 1
          ....: a + b
  
          [You will see an iframe with the pythontutor.com page including the 
          code above]
          '''
          args = parse_argstring(self.tutor, line)
  
          if args.lang:
              if args.lang[0].lower() in ['python2', 
                                          'python3',
  					'py3anaconda',
                                          'java', 
                                          'javascript',
                                          'typescript',
                                          'ruby',
                                          'c',
                                          'c++']:
                  lang = args.lang[0].lower()
              else:
                  raise ValueError(
                      "{} not supported. Only the following options are allowed: "
                      "'python2', 'python3', 'py3anaconda', 'java', 'javascript', "
                      "'typescript', 'ruby', 'c', 'c++'".format(args.lang[0]))
          else:
              lang = "python3"
  
          # Sometimes user will want SSL pythontutor site if 
          # jupyter/hub is using SSL as well
          protocol = 'http://'
          if args.secure:
              protocol = 'https://'
  
          url = protocol + "pythontutor.com/iframe-embed.html#code="
          url += quote(cell)
          url += "&origin=opt-frontend.js"
  
          # Add custom pythontutor options, defaults to all false
          url += "&cumulative={}".format(str(args.cumulative).lower())
          url += "&heapPrimitives={}".format(str(args.heapPrimitives).lower())
          url += "&textReferences={}".format(str(args.textReferences).lower())
          url += "&curInstr={}&".format(str(args.curInstr).lower())
          url += "&verticalStack={}&".format(str(args.verticalStack).lower())
  
          # Setup the language URL param
          if lang == "python3":
              url += "py=3"
          elif lang == "python2":
              url += "py=2"
          elif lang == "py3anaconda":
              url += "py=py3anaconda"
          elif lang == "java":
              url += "py=java"
          elif lang == "javascript":
              url += "py=js"
          elif lang == "typescript":
              url += "py=ts"
          elif lang == "ruby":
              url += "py=ruby"
          elif lang == "c":
              url += "py=c"
          elif lang == "c++":
              url += "py=cpp"
          
          # Add the rest of the misc options to pythontutor
          url += "&rawInputLstJSON=%5B%5D&codeDivWidth=50%25&codeDivHeight=100%25"       
  
          # Display in new tab, or in iframe, or link to it via anchor link?
          if args.link:
              # Create html link to pythontutor
              css = ("box-sizing: border-box; "
                     "padding: 0 5px; border: "
                     "1px solid #CFCFCF;")
              display(
                  HTML(
                      data=(
                          '<div class="text-center"><strong>'
                          '<a style="{0}" target="_" href={1}>Python Tutor</a>'
                          '</strong></div>'.format(css, url)
                      )
                  )
              )
          elif args.tab:
              # Open up a new tab in the browser to pythontutor URL
              webbrowser.open_new_tab(url)
          else:
              # Display the results in the output area
              if args.height:
                  display(IFrame(
                      url, height = int(args.height[0]), width = "100%"
                  ))
              else:
                  display(IFrame(url, height = 350, width = "100%"))
          if args.run:
  			# Run cell like normal
              self.shell.run_cell(cell)
code_tokens: def tutor ( self , line , cell = None , local_ns = None ) : args = parse_argstring ( self . tutor , line ) if args . lang : if args . lang [ 0 ] . lower ( ) in [ 'python2' , 'python3' , 'py3anaconda' , 'java' , 'javascript' , 'typescript' , 'ruby' , 'c' , 'c++' ] : lang = args . lang [ 0 ] . lower ( ) else : raise ValueError ( "{} not supported. Only the following options are allowed: " "'python2', 'python3', 'py3anaconda', 'java', 'javascript', " "'typescript', 'ruby', 'c', 'c++'" . format ( args . lang [ 0 ] ) ) else : lang = "python3" protocol = 'http://' if args . secure : protocol = 'https://' url = protocol + "pythontutor.com/iframe-embed.html#code=" url += quote ( cell ) url += "&origin=opt-frontend.js" url += "&cumulative={}" . format ( str ( args . cumulative ) . lower ( ) ) url += "&heapPrimitives={}" . format ( str ( args . heapPrimitives ) . lower ( ) ) url += "&textReferences={}" . format ( str ( args . textReferences ) . lower ( ) ) url += "&curInstr={}&" . format ( str ( args . curInstr ) . lower ( ) ) url += "&verticalStack={}&" . format ( str ( args . verticalStack ) . lower ( ) ) if lang == "python3" : url += "py=3" elif lang == "python2" : url += "py=2" elif lang == "py3anaconda" : url += "py=py3anaconda" elif lang == "java" : url += "py=java" elif lang == "javascript" : url += "py=js" elif lang == "typescript" : url += "py=ts" elif lang == "ruby" : url += "py=ruby" elif lang == "c" : url += "py=c" elif lang == "c++" : url += "py=cpp" url += "&rawInputLstJSON=%5B%5D&codeDivWidth=50%25&codeDivHeight=100%25" if args . link : css = ( "box-sizing: border-box; " "padding: 0 5px; border: " "1px solid #CFCFCF;" ) display ( HTML ( data = ( '<div class="text-center"><strong>' '<a style="{0}" target="_" href={1}>Python Tutor</a>' '</strong></div>' . format ( css , url ) ) ) ) elif args . tab : webbrowser . open_new_tab ( url ) else : if args . height : display ( IFrame ( url , height = int ( args . height [ 0 ] ) , width = "100%" ) ) else : display ( IFrame ( url , height = 350 , width = "100%" ) ) if args . run : self . shell . run_cell ( cell )
short_docstring: Create an iframe embedding the pythontutor.com page
  with the code included in the code cell::
short_docstring_tokens: Create an iframe embedding the pythontutor . com page with the code included in the code cell ::
comment: '''
          Create an iframe embedding the pythontutor.com page
          with the code included in the code cell::
  
          In [1]: %%tutor -l 'python3'
          ....: a = 1
          ....: b = 1
          ....: a + b
  
          [You will see an iframe with the pythontutor.com page including the 
          code above]
          '''$SEP$# Sometimes user will want SSL pythontutor site if $SEP$# jupyter/hub is using SSL as well$SEP$# Add custom pythontutor options, defaults to all false$SEP$# Setup the language URL param$SEP$# Add the rest of the misc options to pythontutor$SEP$# Display in new tab, or in iframe, or link to it via anchor link?$SEP$# Create html link to pythontutor$SEP$# Open up a new tab in the browser to pythontutor URL$SEP$# Display the results in the output area$SEP$# Run cell like normal