def maintenance_report(labels, trend, active_maintenance=[], title=""):

    created_counts = [len(t[0]) for t in trend]
    resolved_counts = [len(t[1]) for t in trend]

    mntc_chart = maintenance_created_vs_resolved_chart(labels, created_counts,
                                                       resolved_counts)
    content = page.embed_image(filename=mntc_chart)

    averages = []
    stds = []

    for t in trend:
        resolved = t[1]
        lead_time = []
        for i in resolved:
            lead_time.append(i.calc_lead_time())
        averages.append(int(round(np.average(lead_time), 0)))
        stds.append(round(np.std(lead_time), 0))

    lt_chart = resolved_issues_lead_times(labels, averages, stds)
    content += page.embed_image(filename=lt_chart)

    if active_maintenance:
        content += page.format_text(
            "p", f"Active maintenance: {len(active_maintenance)}")
        content += page.embed_expand_macro(
            page.embed_jira_macro(
                f'issuekey in ({", ".join(active_maintenance)})'),
            "Maintenance backlog",
        )
    return content, [mntc_chart, lt_chart]
def carry_over_issues(
    jira_access,
    project_key,
    status_done=("Done"),
    issuetype=("User Story", "Task", "Bug", "User Story Bug",
               "Technical Debt"),
):
    # JQL = f'project = {project_key} AND type not in (Sub-bug, "Sub Story", "Sub Task", Sub-Task) and sprint is not EMPTY AND sprint in closedSprints() AND sprint in openSprints() AND status not in ({status_done})'
    JQL = f"project = {project_key} and issuetype in {issuetype} and sprint is not EMPTY AND sprint in closedSprints() AND sprint in openSprints() AND status not in ({status_done})"
    return page.embed_expand_macro(page.embed_jira_macro(JQL),
                                   "Carry over issues"), []