def get_active_web_certificate(course, is_preview_mode=None):
 certificates = getattr(course, 'certificates', '{}')
 configurations = certificates.get('certificates', [])
 for config in configurations:
  if (config.get('is_active') or is_preview_mode):
   return config
 return None

def get_active_web_certificate ( course , is_preview_mode = None ) : certificates = getattr ( course , 'certificates' , '{}' ) configurations = certificates . get ( 'certificates' , [ ] ) for config in configurations : if ( config . get ( 'is_active' ) or is_preview_mode ) : return config return None
retrieves the active web certificate configuration for the specified course .