docs: def select(soup, selector):
      """
      soup should be a BeautifulSoup instance; selector is a CSS selector 
      specifying the elements you want to retrieve.
      """
      tokens = selector.split()
      current_context = [soup]
      for token in tokens:
          m = attribselect_re.match(token)
          if m:
              # Attribute selector
              tag, attribute, operator, value = m.groups()
              if not tag:
                  tag = True
              checker = attribute_checker(operator, attribute, value)
              found = []
              for context in current_context:
                  found.extend([el for el in context.findAll(tag) if checker(el)])
              current_context = found
              continue
          if '#' in token:
              # ID selector
              tag, id = token.split('#', 1)
              if not tag:
                  tag = True
              el = current_context[0].find(tag, {'id': id})
              if not el:
                  return [] # No match
              current_context = [el]
              continue
          if '.' in token:
              # Class selector
              tag, klass = token.split('.', 1)
              if not tag:
                  tag = True
              found = []
              for context in current_context:
                  found.extend(
                      context.findAll(tag,
                          {'class': lambda attr: attr and klass in attr.split()}
                      )
                  )
              current_context = found
              continue
          if token == '*':
              # Star selector
              found = []
              for context in current_context:
                  found.extend(context.findAll(True))
              current_context = found
              continue
          # Here we should just have a regular tag
          if not tag_re.match(token):
              return []
          found = []
          for context in current_context:
              found.extend(context.findAll(token))
          current_context = found
      return current_context