def _get_gating_info(course, xblock):
 info = {}
 if ((xblock.category == 'sequential') and course.enable_subsection_gating):
  if (not hasattr(course, 'gating_prerequisites')):
   setattr(course, 'gating_prerequisites', gating_api.get_prerequisites(course.id))
  info['is_prereq'] = gating_api.is_prerequisite(course.id, xblock.location)
  info['prereqs'] = [p for p in course.gating_prerequisites if (unicode(xblock.location) not in p['namespace'])]
  (prereq, prereq_min_score) = gating_api.get_required_content(course.id, xblock.location)
  info['prereq'] = prereq
  info['prereq_min_score'] = prereq_min_score
  if prereq:
   info['visibility_state'] = VisibilityState.gated
 return info

def _get_gating_info ( course , xblock ) : info = { } if ( ( xblock . category == 'sequential' ) and course . enable_subsection_gating ) : if ( not hasattr ( course , 'gating_prerequisites' ) ) : setattr ( course , 'gating_prerequisites' , gating_api . get_prerequisites ( course . id ) ) info [ 'is_prereq' ] = gating_api . is_prerequisite ( course . id , xblock . location ) info [ 'prereqs' ] = [ p for p in course . gating_prerequisites if ( unicode ( xblock . location ) not in p [ 'namespace' ] ) ] ( prereq , prereq_min_score ) = gating_api . get_required_content ( course . id , xblock . location ) info [ 'prereq' ] = prereq info [ 'prereq_min_score' ] = prereq_min_score if prereq : info [ 'visibility_state' ] = VisibilityState . gated return info
returns a dict containing gating information for the given xblock which can be added to xblock info responses .