code: def add_category(self, category):
          '''
          Add unicode category to set
          Unicode categories are strings like 'Ll', 'Lu', 'Nd', etc.
          See `unicodedata.category()`
          '''
          if category == sre.CATEGORY_DIGIT:
              self._categories |= UNICODE_DIGIT_CATEGORIES
          elif category == sre.CATEGORY_NOT_DIGIT:
              self._categories |= UNICODE_CATEGORIES - UNICODE_DIGIT_CATEGORIES
          elif category == sre.CATEGORY_SPACE:
              self._categories |= UNICODE_SPACE_CATEGORIES
              for c in (UNICODE_SPACE_CHARS if self._unicode else SPACE_CHARS):
                  self._whitelist_chars.add(c)
          elif category == sre.CATEGORY_NOT_SPACE:
              self._categories |= UNICODE_CATEGORIES - UNICODE_SPACE_CATEGORIES
              for c in (UNICODE_SPACE_CHARS if self._unicode else SPACE_CHARS):
                  self._blacklist_chars.add(c)
          elif category == sre.CATEGORY_WORD:
              self._categories |= UNICODE_WORD_CATEGORIES
              self._whitelist_chars.add(u'_')
              if HAS_WEIRD_WORD_CHARS and self._unicode:
                  for c in UNICODE_WEIRD_NONWORD_CHARS:
                      self._blacklist_chars.add(c)
          elif category == sre.CATEGORY_NOT_WORD:
              self._categories |= UNICODE_CATEGORIES - UNICODE_WORD_CATEGORIES
              self._blacklist_chars.add(u'_')
              if HAS_WEIRD_WORD_CHARS and self._unicode:
                  for c in UNICODE_WEIRD_NONWORD_CHARS:
                      self._whitelist_chars.add(c)