<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_content(self, content_pattern_names, content, encoding):
 """Check which of the named patterns matches the given content. Returns a pair (matching, nonmatching), in which each element is a tuple of pattern names. :param iterable content_pattern_names: names of content patterns to check. :param bytes content: the content to check. :param str encoding: the expected encoding of content. """

    if not content_pattern_names or not encoding:
      return (), ()

    matching = []
    nonmatching = []
    for content_pattern_name in content_pattern_names:
      if self._content_matchers[content_pattern_name].matches(content.decode(encoding)):
        matching.append(content_pattern_name)
      else:
        nonmatching.append(content_pattern_name)
    return tuple(matching), tuple(nonmatching)