code: def select_executor(elem, doc):
      
      executor = EXECUTORS['default']
  
      if 'cmd' in elem.attributes.keys():
          executor = elem.attributes['cmd']
      elif 'runas' in elem.attributes.keys():
          executor = EXECUTORS[elem.attributes['runas']]
      elif elem.classes[0] != 'exec':
          executor = EXECUTORS[elem.classes[0]]
  
      return executor
docs: Determines the executor for the code in `elem.text`.
  
      The elem attributes and classes select the executor in this order (highest
      to lowest):
          - custom commands (cmd=...)
          - runas (runas=...) takes a key for the executors
          - first element class (.class) determines language and thus executor
  
      Args:
          elem The AST element.
          doc  The document.
  
      Returns:
          The command to execute code.