<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replace(self, pat, rep):
 """Replace first occurrence of pat with rep in each element. Parameters pat : str rep : str Returns ------- Series """

        check_type(pat, str)
        check_type(rep, str)

        return _series_str_result(self, weld_str_replace, pat=pat, rep=rep)