def METHOD_NAME(apps, portfolio, user):
    User = apps.get_model('siteapp', 'User')
    UserObjectPermission = apps.get_model('guardian', 'UserObjectPermission')
    Permission = apps.get_model('auth', 'Permission')
    portfolio_type, created = ContentType.objects.get_or_create(app_label='siteapp', model='portfolio')
    view_portfolio, created = Permission.objects.get_or_create(codename='view_portfolio', content_type_id=portfolio_type.id)
    change_portfolio, created = Permission.objects.get_or_create(codename='change_portfolio', content_type_id=portfolio_type.id)
    add_portfolio, created = Permission.objects.get_or_create(codename='add_portfolio', content_type_id=portfolio_type.id)
    permissions = [view_portfolio, change_portfolio, add_portfolio]
    user_lookup = User.objects.get(id=user.id)
    for perm in permissions:
        print(portfolio, portfolio.title)
        UserObjectPermission.objects.get_or_create(
            permission=perm, user=user_lookup, object_pk=portfolio.pk, content_type_id=portfolio_type.id)