<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def report_urls(impact_function):
 """Get report urls for all report generated by the ImpactFunction. :param impact_function: The ImpactFunction :type impact_function: ImpactFunction :return: Dictionary of all generated report urls by its product type eg: { 'html_product_tag': { 'action-checklist-report': 'path_to_the_report', 'analysis-provenance-details-report': 'path_to_the_report', 'analysis-result-html': 'path_to_the_report' }, 'pdf_product_tag': { 'inasafe-map-report-portrait': 'path_to_the_report', 'inasafe-map-report-landscape':, 'path_to_the_report', 'population-infographic': 'path_to_the_report' } 'qpt_product_tag': { 'inasafe-map-report-portrait': 'path_to_the_report', 'inasafe-map-report-landscape': 'path_to_the_report', 'population-infographic': 'path_to_the_report' } } :rtype: dict """

    report_path = impact_function.impact_report.output_folder
    standard_report_metadata = impact_function.report_metadata

    def retrieve_components(tags):
        """Retrieve components from report metadata."""
        products = []
        for report_metadata in standard_report_metadata:
            products += (report_metadata.component_by_tags(tags))
        return products

    def retrieve_paths(products, report_path, suffix):
        """Helper method to retrieve path from particular report metadata.
        """
        paths = {}
        for product in products:
            path = ImpactReport.absolute_output_path(
                report_path,
                products,
                product.key)
            if isinstance(path, list):
                for p in path:
                    if p.endswith(suffix) and exists(p):
                        paths[product.key] = p
            elif isinstance(path, dict):
                for p in list(path.values()):
                    if p.endswith(suffix) and exists(p):
                        paths[product.key] = p
            elif exists(path):
                paths[product.key] = path

        return paths

    pdf_products = retrieve_components(
        [final_product_tag, pdf_product_tag])
    pdf_output_paths = retrieve_paths(
        pdf_products, report_path=report_path, suffix='.pdf')

    html_products = retrieve_components(
        [final_product_tag, html_product_tag])
    html_output_paths = retrieve_paths(
        html_products, report_path=report_path, suffix='.html')

    qpt_products = retrieve_components(
        [final_product_tag, qpt_product_tag])
    qpt_output_paths = retrieve_paths(
        qpt_products, report_path=report_path, suffix='.qpt')

    report_paths = {
        pdf_product_tag['key']: pdf_output_paths,
        html_product_tag['key']: html_output_paths,
        qpt_product_tag['key']: qpt_output_paths
    }

    return report_paths