Function used to get a object
    :param app_label: A valid Django Model or a string with format: <app_label>.<model_name>
    :param model_name: Key into kwargs that contains de data: new_person
    :param object_id:
    :return: instance
499664
def get_obj(app_label, model_name, object_id):
    
    try:
        model = apps.get_model("{}.{}".format(app_label, model_name))
        assert is_valid_django_model(model), ("Model {}.{} do not exist.").format(
            app_label, model_name
        )

        obj = get_Object_or_None(model, pk=object_id)
        return obj

    except model.DoesNotExist:
        return None
    except LookupError:
        pass
    except ValidationError as e:
        raise ValidationError(e.__str__())
    except TypeError as e:
        raise TypeError(e.__str__())
    except Exception as e:
        raise Exception(e.__str__())
1064019
def _get_model_instance(model_cls, data):
        
        if not isinstance(data, (model_cls, dict)):
            raise TypeError('{0} is not valid type, instance of '
                            '{1} or dict required'.format(data, model_cls))
        return model_cls(**data) if isinstance(data, dict) else data
145451
def get_label(self, name):
        
        assert isinstance(name, (str, unicode)), name
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/labels/" + urllib.quote(name)
        )
        return github.Label.Label(self._requester, headers, data, completed=True)
685766
function getLabel(app, options) {
  if (typeof options.getLabel === 'function') {
    return options.getLabel(app, options);
  }
  return app.full_name || app.nickname || app.name;
}
432496
def load_object(self, kwargs):
        """"""
        self.object = None
        self.config = None
        self.model = self.get_model_class()
        kwargs.pop('app', None)
        kwargs.pop('model', None)

        if self.model and kwargs.get('pk', False):
            try:
                self.object = self.model.objects.get(pk=kwargs.pop('pk'))
            except Exception:
                raise Exception("Could not load {}".format(self.model.__name__.lower()))
            setattr(self, self.model.__name__.lower(), self.object)

        return kwargs
35839
public static appflowpolicylabel get(nitro_service service, String labelname) throws Exception{
		appflowpolicylabel obj = new appflowpolicylabel();
		obj.set_labelname(labelname);
		appflowpolicylabel response = (appflowpolicylabel) obj.get_resource(service);
		return response;
	}
151476
def update_rel_to(self, klass):
        

        if isinstance(self.remote_field.to, basestring):
            relation = self.remote_field.to
            try:
                app_label, model_name = relation.split(".")
            except ValueError:
                # If we can't split, assume a model in current app
                app_label = klass._meta.app_label
                model_name = relation

            model = None
            try:
                model = klass._meta.apps.get_registered_model(app_label, model_name)
            # For django < 1.6
            except AttributeError:
                model = models.get_model(
                    app_label, model_name,
                    seed_cache=False, only_installed=False)
            except LookupError:
                pass

            if model:
                self.remote_field.model = model
555053
def get_model_label(model):
    
    if isinstance(model, six.string_types):
        return model
    else:
        return "%s.%s" % (
            model._meta.app_label,
            model.__name__
        )
1264400
def model_deleted(sender, instance,
                          using,
                          **kwargs):
    
    opts = get_opts(instance)
    model = '.'.join([opts.app_label, opts.object_name])
    distill_model_event(instance, model, 'deleted')
1117206
def dependency(app_label, model):
    
    from django.db.migrations import swappable_dependency
    return swappable_dependency(get_model_name(app_label, model))
1370870
def register_model(self, app, model_name, field_type, field_definitions):
        
        from django.apps import apps
        import collections

        app_label = app

        if isinstance(field_definitions, str):
            field_definitions = [field_definitions]
        elif not isinstance(field_definitions, collections.Iterable):
            raise ImproperlyConfigured(_('Field configuration for %(app)s should be a string or iterable') % {'app': app})

        if field_type not in ('ForeignKey', 'ManyToManyField'):
            raise ImproperlyConfigured(_('`field_type` must be either `"ForeignKey"` or `"ManyToManyField"`.'))

        try:
            if not hasattr(model_name, "_meta"):
                app_config = apps.get_app_config(app)
                app_label = app_config.label
                model = app_config.get_model(model_name)
            else:
                model = model_name
                model_name = model._meta.model_name
            opts = model._meta
            if app_label not in self._model_registry:
                self._model_registry[app_label] = []
            if model not in self._model_registry[app_label]:
                self._model_registry[app_label].append(model)
        except LookupError:
            raise ImproperlyConfigured('Model "%(model)s" doesn\'t exist in app "%(app)s".' % {'model': model_name, 'app': app})

        if not isinstance(field_definitions, (tuple, list)):
            field_definitions = [field_definitions]

        for fld in field_definitions:
            extra_params = {'to': 'categories.Category', 'blank': True}
            if field_type != 'ManyToManyField':
                extra_params['on_delete'] = CASCADE
                extra_params['null'] = True
            if isinstance(fld, str):
                field_name = fld
            elif isinstance(fld, dict):
                if 'name' in fld:
                    field_name = fld.pop('name')
                else:
                    continue
                extra_params.update(fld)
            else:
                raise ImproperlyConfigured(
                    _("%(settings)s doesn't recognize the value of %(app)s.%(model)s") % {
                        'settings': 'CATEGORY_SETTINGS',
                        'app': app,
                        'model': model_name})
            registry_name = ".".join([app_label, model_name.lower(), field_name])
            if registry_name in self._field_registry:
                continue

            try:
                opts.get_field(field_name)
            except FieldDoesNotExist:
                self._field_registry[registry_name] = FIELD_TYPES[field_type](**extra_params)
                self._field_registry[registry_name].contribute_to_class(model, field_name)
332135
def value_from_object(self, obj):
        
        try:
            # not using self.attname, access the descriptor instead.
            placeholder = getattr(obj, self.name)
        except Placeholder.DoesNotExist:
            return None   # Still allow ModelForm / admin to open and create a new Placeholder if the table was truncated.

        return placeholder.id if placeholder else None
471164
def label(self, name):
        
        json = None
        if name:
            url = self._build_url('labels', name, base_url=self._api)
            json = self._json(self._get(url), 200)
        return Label(json, self) if json else None
423809
def get_entity_kind(self, model_obj):
        
        model_obj_ctype = ContentType.objects.get_for_model(self.queryset.model)
        return (u'{0}.{1}'.format(model_obj_ctype.app_label, model_obj_ctype.model), u'{0}'.format(model_obj_ctype))
1066902
def model_page(self, request, app_label, model_name, rest_of_url=None):
        
        try:
            model = get_model(app_label, model_name)
        except LookupError:
            model = None

        if model is None:
            raise http.Http404("App %r, model %r, not found." %
                               (app_label, model_name))
        try:
            databrowse_class = self.registry[model]
        except KeyError:
            raise http.Http404("This model exists but has not been registered "
                               "with databrowse.")
        return databrowse_class(model, self).root(request, rest_of_url)
202743
def get(*args)
      arguments(args, required: [:user, :repo, :label_name])
      params = arguments.params

      get_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", params)
    end
127499
def get_group_model():
    
    from django.apps import apps
    model_string = get_group_model_string()
    try:
        return apps.get_model(model_string)
    except ValueError:
        raise ImproperlyConfigured("JOYOUS_GROUP_MODEL must be of the form 'app_label.model_name'")
    except LookupError:
        raise ImproperlyConfigured(
            "JOYOUS_GROUP_MODEL refers to model '%s' that has not been installed" % model_string
        )