code: def _open_file_in_editor(self, filename):
          
          # If the 'VISUAL' or 'EDITOR' environment variable has been set, use that.
          # Otherwise, fall back to the first available editor that we can find.
          visual = os.environ.get('VISUAL')
          editor = os.environ.get('EDITOR')
  
          editors = [
              visual,
              editor,
  
              # Order of preference.
              '/usr/bin/editor',
              '/usr/bin/nano',
              '/usr/bin/pico',
              '/usr/bin/vi',
              '/usr/bin/emacs',
          ]
  
          for e in editors:
              if e:
                  try:
                      # Use 'shlex.split()', because $VISUAL can contain spaces
                      # and quotes.
                      returncode = subprocess.call(shlex.split(e) + [filename])
                      return returncode == 0
  
                  except OSError:
                      # Executable does not exist, try the next one.
                      pass
  
          return False
docs: Call editor executable.
  
          Return True when we received a zero return code.