<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def output_cert(gandi, cert, output_keys, justify=13):
 """Helper to output a certificate information."""

    output = list(output_keys)

    display_altnames = False
    if 'altnames' in output:
        display_altnames = True
        output.remove('altnames')

    display_output = False
    if 'cert' in output:
        display_output = True
        output.remove('cert')

    output_generic(gandi, cert, output, justify)

    if display_output:
        crt = gandi.certificate.pretty_format_cert(cert)
        if crt:
            output_line(gandi, 'cert', '\n' + crt, justify)

    if display_altnames:
        for altname in cert['altnames']:
            output_line(gandi, 'altname', altname, justify)