async def METHOD_NAME(
    backend, author, realm_id, user_id, role, timestamp=None
):
    now = timestamp or next_timestamp()
    certif = RealmRoleCertificate(
        author=author.device_id, timestamp=now, realm_id=realm_id, user_id=user_id, role=role
    ).dump_and_sign(author.signing_key)
    await backend.realm.update_roles(
        author.organization_id,
        RealmGrantedRole(
            certificate=certif,
            realm_id=realm_id,
            user_id=user_id,
            role=role,
            granted_by=author.device_id,
            granted_on=now,
        ),
    )
    return certif