def get_collection_from_model(collection_model, run_conversion=True):
 versioned_collection = {'schema_version': collection_model.schema_version, 'nodes': copy.deepcopy(collection_model.nodes)}
 if (run_conversion and (collection_model.schema_version != feconf.CURRENT_COLLECTION_SCHEMA_VERSION)):
  _migrate_collection_to_latest_schema(versioned_collection)
 return collection_domain.Collection(collection_model.id, collection_model.title, collection_model.category, collection_model.objective, collection_model.language_code, collection_model.tags, versioned_collection['schema_version'], [collection_domain.CollectionNode.from_dict(collection_node_dict) for collection_node_dict in versioned_collection['nodes']], collection_model.version, collection_model.created_on, collection_model.last_updated)

def get_collection_from_model ( collection_model , run_conversion = True ) : versioned_collection = { 'schema_version' : collection_model . schema_version , 'nodes' : copy . deepcopy ( collection_model . nodes ) } if ( run_conversion and ( collection_model . schema_version != feconf . CURRENT_COLLECTION_SCHEMA_VERSION ) ) : _migrate_collection_to_latest_schema ( versioned_collection ) return collection_domain . Collection ( collection_model . id , collection_model . title , collection_model . category , collection_model . objective , collection_model . language_code , collection_model . tags , versioned_collection [ 'schema_version' ] , [ collection_domain . CollectionNode . from_dict ( collection_node_dict ) for collection_node_dict in versioned_collection [ 'nodes' ] ] , collection_model . version , collection_model . created_on , collection_model . last_updated )
returns a collection domain object given a collection model loaded from the datastore .