def instantiate(self, predecessor=None, instance_kwargs=None, request=None, **kwargs):
    assert (not self.instance)
    assert (not predecessor)
    instance_kwargs = (instance_kwargs or {})
    request_user = (request.user if (request and request.user.is_authenticated) else None)
    (user, group) = self._get_assignment(request_user=request_user, predecessor=predecessor)
    if ('assigned_user' not in instance_kwargs):
        instance_kwargs['assigned_user'] = user
    if ('assigned_group' not in instance_kwargs):
        instance_kwargs['assigned_group'] = group
    self.instance = self.flow.activity_model(process=self.process, activity_name=self.name, **(instance_kwargs or {}))
def instantiate(self, predecessor=None, instance_kwargs=None, request=None, **kwargs):
    assert (not self.instance)
    assert (not predecessor)
    instance_kwargs = (instance_kwargs or {})
    request_user = (request.user if (request and request.user.is_authenticated) else None)
    (user, group) = self._get_assignment(request_user=request_user, predecessor=predecessor)
    if ('assigned_user' not in instance_kwargs):
        instance_kwargs['assigned_user'] = user
    if ('assigned_group' not in instance_kwargs):
        instance_kwargs['assigned_group'] = group
    self.instance = self.flow.activity_model(process=self.process, activity_name=self.name, **(instance_kwargs or {}))