<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query(self, ns, selector='*'):
 """ Query the label store for labels :param ns: Label namespace (`bind_pwd` for example) :type ns: str :param selector: Target selector (`test` or `test.guest` for example) :type selector: str """

    q, r = HicaLabelStore.PREFIX + '.' + ns, []
    for (key, value) in self.items:
      if not selector and key == q:
        r.append((key, value))
      if key.startswith(q) and key != q:
        sub = key[len(q):]
        m = re.match('.' + selector, sub)
        if m:
          r.append((key, value))
    return r