parameters: (pattern, flags=0)
return_statement: return pattern
docstring: Apply the search backrefs to the search pattern.
docstring_summary: Apply the search backrefs to the search pattern.
docstring_tokens: Apply the search backrefs to the search pattern .
function: def _apply_search_backrefs(pattern, flags=0):
      """Apply the search backrefs to the search pattern."""
  
      if isinstance(pattern, (_util.string_type, _util.binary_type)):
          re_verbose = bool(VERBOSE & flags)
          re_unicode = None
          if _util.PY3 and bool((ASCII | LOCALE) & flags):
              re_unicode = False
          elif bool(UNICODE & flags):
              re_unicode = True
          if not (flags & DEBUG):
              pattern = _cached_search_compile(pattern, re_verbose, re_unicode, type(pattern))
          else:  # pragma: no cover
              pattern = _bre_parse._SearchParser(pattern, re_verbose, re_unicode).parse()
      elif isinstance(pattern, Bre):
          if flags:
              raise ValueError("Cannot process flags argument with a compiled pattern")
          pattern = pattern._pattern
      elif isinstance(pattern, (_RE_TYPE, Bre)):
          if flags:
              raise ValueError("Cannot process flags argument with a compiled pattern!")
      else:
          raise TypeError("Not a string or compiled pattern!")
      return pattern
function_tokens: def _apply_search_backrefs ( pattern , flags = 0 ) : if isinstance ( pattern , ( _util . string_type , _util . binary_type ) ) : re_verbose = bool ( VERBOSE & flags ) re_unicode = None if _util . PY3 and bool ( ( ASCII | LOCALE ) & flags ) : re_unicode = False elif bool ( UNICODE & flags ) : re_unicode = True if not ( flags & DEBUG ) : pattern = _cached_search_compile ( pattern , re_verbose , re_unicode , type ( pattern ) ) else : # pragma: no cover pattern = _bre_parse . _SearchParser ( pattern , re_verbose , re_unicode ) . parse ( ) elif isinstance ( pattern , Bre ) : if flags : raise ValueError ( "Cannot process flags argument with a compiled pattern" ) pattern = pattern . _pattern elif isinstance ( pattern , ( _RE_TYPE , Bre ) ) : if flags : raise ValueError ( "Cannot process flags argument with a compiled pattern!" ) else : raise TypeError ( "Not a string or compiled pattern!" ) return pattern