def increment_attempt(pending_certificate):
    """
    Increments pending certificate attempt counter and updates it in the database.
    """
    pending_certificate.number_attempts += 1
    database.update(pending_certificate)

    log_service.audit_log("increment_attempt_pending_certificate", pending_certificate.name,
                          "Incremented attempts for the pending certificate")
    return pending_certificate.number_attempts

    Increments pending certificate attempt counter and updates it in the database.
    
lemur/pending_certificates/service.py