def get_permission_and_content_type(self, permission, obj=None):
        
        perm_ct = None
        bits = permission.split('.')
        app_label = bits.pop(0)
        if len(bits) >= 3:
            # either a ContentType was given, or this is a long codename
            try:
                perm_ct = ContentType.objects.get(
                    app_label=bits[-2], model=bits[-1])
            except ContentType.DoesNotExist:
                codename = '.'.join(bits)
            else:
                codename = '.'.join(bits[:-2])
        else:
            codename = '.'.join(bits)
        
        obj_ct = None
        if obj:
            obj_ct = ContentType.objects.get_for_model(obj)
        
        content_type = perm_ct or obj_ct
        if not (content_type):
            raise PermissionLookupError('ContentType must be given in permission, or object must be passed.')
        if perm_ct and obj_ct and perm_ct != obj_ct:
            raise PermissionLookupError('ContentType in permission and passed object mismatched.')
        
        try:
            return (
                self.get(
                    app_label=app_label,
                    content_types=content_type,
                    codename=codename
                ),
                content_type
            )
        except self.model.DoesNotExist:
            raise PermissionLookupError('AppPermission not found.')
Check that this string is a valid URN
dataset/ETHPy150Open jlecker/django-rubberstamp/rubberstamp/models.py/AppPermissionManager.get_permission_and_content_type--crossover with--dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/ext/geni/util/urn_util.py/is_valid_urn