<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pyc2py(filename):
 """ Find corresponding .py name given a .pyc or .pyo """

    if re.match(".*py[co]$", filename):
        if PYTHON3:
            return re.sub(r'(.*)__pycache__/(.+)\.cpython-%s.py[co]$' % PYVER,
                          '\\1\\2.py',
                          filename)
        else:
            return filename[:-1]
    return filename