def get_object_id(model, meteor_id):
if meteor_id is None:<EOL><INDENT>return None<EOL><DEDENT>meta = model._meta<EOL>if model is ObjectMapping:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if isinstance(meta.pk, AleaIdField):<EOL><INDENT>return meteor_id<EOL><DEDENT>alea_unique_fields = [<EOL>field<EOL>for field in meta.local_fields<EOL>if isinstance(field, AleaIdField) and field.unique<EOL>]<EOL>if len(alea_unique_fields) == <NUM_LIT:1>:<EOL><INDENT>val = model.objects.values_list(<EOL>'<STR_LIT>', flat=True,<EOL>).get(**{<EOL>alea_unique_fields[<NUM_LIT:0>].attname: meteor_id,<EOL>})<EOL>if val:<EOL><INDENT>return val<EOL><DEDENT><DEDENT>content_type = ContentType.objects.get_for_model(model)<EOL>return ObjectMapping.objects.filter(<EOL>content_type=content_type,<EOL>meteor_id=meteor_id,<EOL>).values_list('<STR_LIT>', flat=True).get()<EOL>
Return an object ID for the given meteor_id.