code: def _contains(expr, pat, case=True, flags=0, regex=True):
      
  
      if regex and isinstance(pat, six.string_types):
          import re
          try:
              re.compile(pat, flags=flags)
          except:
              raise ValueError('Failed to compile regular expression, '
                               'please check re.compile("{0}")'.format(pat))
  
      return _string_op(expr, Contains, output_type=types.boolean,
                        _pat=pat, _case=case, _flags=flags, _regex=regex)
docs: Return boolean sequence whether given pattern/regex is contained in each string in the sequence
  
      :param expr: sequence or scalar
      :param pat: Character sequence or regular expression
      :param case: If True, case sensitive
      :type case: bool
      :param flags: re module flags, e.g. re.IGNORECASE
      :param regex: If True use regex, otherwise use string finder
      :return: sequence or scalar