docs: def subgraph(self, nodeids):
          """
          Return an Xmrs object with only the specified *nodeids*.
  
          Necessary variables and arguments are also included in order to
          connect any nodes that are connected in the original Xmrs.
  
          Args:
              nodeids: the nodeids of the nodes/EPs to include in the
                  subgraph.
          Returns:
              An :class:`Xmrs` object.
          """
          _eps, _vars = self._eps, self._vars
          _hcons, _icons = self._hcons, self._icons
          top = index = xarg = None
          eps = [_eps[nid] for nid in nodeids]
          lbls = set(ep[2] for ep in eps)
          hcons = []
          icons = []
          subvars = {}
          if self.top:
              top = self.top
              tophc = _hcons.get(top, None)
              if tophc is not None and tophc[2] in lbls:
                  subvars[top] = {}
              elif top not in lbls:
                  top = None  # nevermind, set it back to None
          # do index after we know if it is an EPs intrinsic variable.
          # what about xarg? I'm not really sure.. just put it in
          if self.xarg:
              xarg = self.xarg
              subvars[self.xarg] = _vars[self.xarg]['props']
          subvars.update((lbl, {}) for lbl in lbls)
          subvars.update(
              (var, _vars[var]['props'])
              for ep in eps for var in ep[3].values()
              if var in _vars
          )
          if self.index in subvars:
              index = self.index
          # hcons and icons; only if the targets exist in the new subgraph
          for var in subvars:
              hc = _hcons.get(var, None)
              if hc is not None and hc[2] in lbls:
                  hcons.append(hc)
              for ic in _icons.get(var, []):
                  if ic[0] in subvars and ic[2] in subvars:
                      icons.append(ic)
          return Xmrs(
              top=top, index=index, xarg=xarg,
              eps=eps, hcons=hcons, icons=icons, vars=subvars,
              lnk=self.lnk, surface=self.surface, identifier=self.identifier
          )