docs: def _varFindLimitSpace(basedir, vars, space, part, lookup_fatal, depth):
      ''' limits the search space of space to part
      
      basically does space.get(part, None), but with
      templating for part and a few more things
      '''
  
      # Previous part couldn't be found, nothing to limit to
      if space is None:
          return space
      # A part with escaped .s in it is compounded by { and }, remove them
      if part[0] == '{' and part[-1] == '}':
          part = part[1:-1]
      # Template part to resolve variables within (${var$var2})
      part = varReplace(basedir, part, vars, lookup_fatal, depth=depth + 1)
  
      # Now find it
      if part in space:
          space = space[part]
      elif "[" in part:
          m = _LISTRE.search(part)
          if not m:
              return None
          else:
              try:
                  space = space[m.group(1)][int(m.group(2))]
              except (KeyError, IndexError):
                  return None
      else:
          return None
  
      # if space is a string, check if it's a reference to another variable
      if isinstance(space, basestring):
          space = template_ds(basedir, space, vars, lookup_fatal, depth)
  
      return space