<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_base_path_and_format(main_path, formats):
 """Return the base path and the format corresponding to the given path"""

    for fmt in formats:
        try:
            return base_path(main_path, fmt), fmt
        except InconsistentPath:
            continue

    raise InconsistentPath(u"Path '{}' matches none of the export formats. "
                           "Please make sure that jupytext.formats covers the current file "
                           "(e.g. add '{}' to the export formats)".format(main_path,
                                                                          os.path.splitext(main_path)[1][1:]))