<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _count(expr, pat, flags=0):
 """ Count occurrences of pattern in each string of the sequence or scalar :param expr: sequence or scalar :param pat: valid regular expression :param flags: re module flags, e.g. re.IGNORECASE :return: """

    return _string_op(expr, Count, output_type=types.int64,
                      _pat=pat, _flags=flags)