code: def compile(patterns, flags):  # noqa A001
      
  
      positive = []
      negative = []
      if isinstance(patterns, (str, bytes)):
          patterns = [patterns]
  
      for pattern in patterns:
          for expanded in expand_braces(pattern, flags):
              (negative if is_negative(expanded, flags) else positive).append(_compile(expanded, flags))
  
      if patterns and flags & REALPATH and negative and not positive:
          positive.append(_compile(b'**' if isinstance(patterns[0], bytes) else '**', flags))
  
      return WcRegexp(tuple(positive), tuple(negative), flags & REALPATH, flags & PATHNAME, flags & FOLLOW)
docs: Compile patterns.