docs: def existing_node_input():
      """
      Get an existing node id by name or id.
  
      Return -1 if invalid
      """
      input_from_user = raw_input("Existing node name or id: ")
      node_id = INVALID_NODE
  
      if not input_from_user:
          return node_id
  
      # int or str?
      try:
          parsed_input = int(input_from_user)
      except ValueError:
          parsed_input = input_from_user
  
      if isinstance(parsed_input, int):
          result = db.execute(text(fetch_query_string('select_node_from_id.sql')),
                  node_id=parsed_input).fetchall()
          if result:
              node_id = int(result[0]['node_id'])
      else:
          result = db.execute(text(fetch_query_string('select_node_from_name.sql')),
                  node_name=parsed_input).fetchall()
          if result:
              if len(result) == 1:
                  print 'Node id: {node_id}\nNode name: {name}'.format(**result[0])
                  print '-------------'
                  node_id = result[0]['node_id']
              else:
                  print 'Multiple nodes found with the name: {0}'.format(parsed_input)
                  for item in result:
                      print '{node_id}: {name} = {value}'.format(**item)
                  node_selection = raw_input('Enter a node id from this list or enter "?" to render all or "?<node>" for a specific one.')
                  if node_selection:
                      node_selection_match = re.match(r"\?(\d)*", node_selection)
                      if node_selection_match:
                          if node_selection_match.groups()[0]:
                              value = render_node(int(node_selection_match.groups()[0]), noderequest={'_no_template':True}, **result[0])
                              print safe_dump(value, default_flow_style=False)
                          else:
                              for item in result:
                                  value = render_node(item['node_id'], noderequest={'_no_template':True}, **item)
                                  print 'Node id: {0}'.format(item['node_id'])
                                  print safe_dump(value, default_flow_style=False)
                                  print '---'
                          node_id = node_input()
                      else:
                          try:
                              node_id = int(node_selection)
                          except ValueError:
                              node_id = INVALID_NODE
                              print 'invalid node id: %s' % node
  
      return node_id