'Returns the ContentType object for a given model, creating the
ContentType if necessary. Lookups are cached so that subsequent lookups
for the same model don\'t hit the database.'

def get_for_model(self, model, for_concrete_model=True):

    opts = self._get_opts(model, for_concrete_model)
    try:
        ct = self._get_from_cache(opts)
    except KeyError:
        (ct, created) = self.get_or_create(app_label=opts.app_label, model=opts.object_name.lower(), defaults={'name': smart_text(opts.verbose_name_raw)})
        self._add_to_cache(self.db, ct)
    return ct
