def reissue(old_certificate_name, notify, commit, serial_numbers):
    """
    Reissues certificate with the same parameters as it was originally issued with.
    If no time period is provided, reissues certificate as valid from today to
    today + length of original.
    Accepts both name and a list of serial numbers; if both are provided, both will be used.
    If neither name nor serial numbers are provided, all certs pending reissue will be reissued.
    Note that serial numbers must be in decimal format (not hex).
    """
    if commit:
        click.echo("[!] Running in COMMIT mode.")

    click.echo("[+] Starting certificate re-issuance.")

    status = FAILURE_METRIC_STATUS

    try:
        certs_to_reissue = []

        old_cert_by_name = validate_certificate(old_certificate_name)
        if old_cert_by_name:
            certs_to_reissue.append(old_cert_by_name)
            click.echo("[+] Reissuing 1 certificate by name")

        old_certs_by_serial_numbers = validate_certificates_by_serial_numbers(serial_numbers)
        if old_certs_by_serial_numbers:
            certs_to_reissue.extend(old_certs_by_serial_numbers)
            click.echo(f"[+] Reissuing {len(old_certs_by_serial_numbers)} certificates by serial number")

        # if neither name nor serial numbers were specified, reissue all pending reissues
        if not certs_to_reissue:
            certs_to_reissue = get_all_pending_reissue()
            if current_app.config.get("REISSUE_FILTER"):
                certs_to_reissue = [c for c in certs_to_reissue if current_app.config.get("REISSUE_FILTER")(c)]
            click.echo(f"[+] Reissuing all {len(certs_to_reissue)} pending certificates.")

        for old_cert in certs_to_reissue:
            request_reissue(old_cert, notify, commit)

        status = SUCCESS_METRIC_STATUS
        click.echo("[+] Done!")
    except Exception as e:
        capture_exception()
        current_app.logger.exception("Error reissuing certificate.", exc_info=True)
        click.echo(f"[!] Failed to reissue certificates. Reason: {e}")

    metrics.send(
        "certificate_reissue_job", "counter", 1, metric_tags={"status": status}
    )

    Reissues certificate with the same parameters as it was originally issued with.
    If no time period is provided, reissues certificate as valid from today to
    today + length of original.
    Accepts both name and a list of serial numbers; if both are provided, both will be used.
    If neither name nor serial numbers are provided, all certs pending reissue will be reissued.
    Note that serial numbers must be in decimal format (not hex).
    
lemur/certificates/cli.py