<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def discover(patches, verbose, name):
 """List the patches available in the given patches directory"""

    patches = _get_mongopatcher().discover(directory=patches)
    if name:
        import re
        patches = [p for p in patches if re.match(name, p.target_version)]
    if not patches:
        print('No patches found')
    else:
        print('Patches available:')
        for patch in patches:
            if verbose:
                print()
                print(patch.target_version)
                print("~" * len(patch.target_version))
                print(tabulate(patch.patchnote))
            else:
                print(' - %s' % patch.target_version)