'We need the instance in question and an id'

def __init__(self, instance, id, context=None, stdout=None, stderr=None, options=None):

    super(InstanceCode, self).__init__(indent=0, stdout=stdout, stderr=stderr)
    self.imports = {}
    self.options = options
    self.instance = instance
    self.model = self.instance.__class__
    if (context is None):
        context = {}
    self.context = context
    self.variable_name = ('%s_%s' % (self.instance._meta.db_table, id))
    self.skip_me = None
    self.instantiated = False
    self.waiting_list = list(self.model._meta.fields)
    self.many_to_many_waiting_list = {}
    for field in self.model._meta.many_to_many:
        self.many_to_many_waiting_list[field] = list(getattr(self.instance, field.name).all())
