'Return a snapshot of all access rules for this course.
This is useful for recording an audit trail of rule changes.
The returned dictionary is JSON-serializable.
Returns:
dict
Example Usage:
>>> restricted_course.snapshot()
\'enroll_msg\': \'default\',
\'access_msg\': \'default\',
\'country_rules\': [
{\'country\': \'IR\', \'rule_type\': \'blacklist\'},
{\'country\': \'CU\', \'rule_type\': \'blacklist\'}'

def snapshot(self):

    country_rules_for_course = CountryAccessRule.objects.select_related('country').filter(restricted_course=self)
    return {'enroll_msg': self.enroll_msg_key, 'access_msg': self.access_msg_key, 'country_rules': [{'country': unicode(rule.country.country), 'rule_type': rule.rule_type} for rule in country_rules_for_course]}
