code: def get_field_keys(self, pattern=None):
          
          # Use own pattern or passed in argument for recursion
          pattern = pattern or self.pattern
  
          # Validate the pattern so we can make assumptions about the data
          self._validate(pattern)
  
          keys = set()
  
          # Valid pattern length can only be 2 or 3
          # With key filters, field key is second item just like 3 item patterns
          if len(pattern) == 2 and pattern[0] not in self._KEY_FILTER_MAP:
              if pattern[0] in ('&', '|', '^'):
                  # Pass each nested pattern to get_field_keys
                  for filter_item in pattern[1]:
                      keys = keys.union(self.get_field_keys(filter_item))
              else:
                  # pattern[0] == '!'
                  keys = keys.union(self.get_field_keys(pattern[1]))
          else:
              # Pattern length is 3
              keys.add(pattern[1])
          return keys
docs: Builds a set of all field keys used in the pattern including nested fields.
  
          :param pattern: The kmatch pattern to get field keys from or None to use self.pattern
          :type pattern: list or None
          :returns: A set object of all field keys used in the pattern
          :rtype: set