<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_ontology(ontology_path):
 """Look for the file in known places. :param ontology: path name or url :type ontology: str :return: absolute path of a file if found, or None """

    last_part = os.path.split(os.path.abspath(ontology_path))[1]
    possible_patterns = [last_part, last_part.lower()]
    if not last_part.endswith('.rdf'):
        possible_patterns.append(last_part + '.rdf')
    places = [os.path.join(current_app.instance_path, "classifier"),
              os.path.abspath('.'),
              os.path.join(os.path.dirname(__file__), "classifier")]

    workdir = current_app.config.get('CLASSIFIER_WORKDIR')
    if workdir:
        places.append(workdir)

    current_app.logger.debug(
        "Searching for taxonomy using string: %s" % last_part)
    current_app.logger.debug("Possible patterns: %s" % possible_patterns)
    for path in places:
        try:
            if os.path.isdir(path):
                current_app.logger.debug("Listing: %s" % path)
                for filename in os.listdir(path):
                    for pattern in possible_patterns:
                        filename_lc = filename.lower()
                        if pattern == filename_lc and\
                                os.path.exists(os.path.join(path, filename)):
                            filepath = os.path.abspath(os.path.join(path,
                                                                    filename))
                            if (os.access(filepath, os.R_OK)):
                                current_app.logger.debug(
                                    "Found taxonomy at: {0}".format(filepath))
                                return filepath
                            else:
                                current_app.logger.warning(
                                    'Found taxonomy at: {0}, but it is'
                                    ' not readable. Continue '
                                    'searching...'.format(
                                        filepath
                                    )
                                )
        except OSError as os_error_msg:
            current_app.logger.exception(
                'OS Error when listing path "{0}": {1}'.format(
                    str(path), str(os_error_msg))
            )
    current_app.logger.debug(
        "No taxonomy with pattern '{0}' found".format(ontology_path))