human
I wrote the below code

    INSTANCE_TYPES = {'m1.tiny': dict(memory_mb=512, vcpus=1, root_gb=0, flavorid=1), 'm1.small': dict(memory_mb=2048, vcpus=1, root_gb=20, flavorid=2), 'm1.medium': dict(memory_mb=4096, vcpus=2, root_gb=40, flavorid=3), 'm1.large': dict(memory_mb=8192, vcpus=4, root_gb=80, flavorid=4), 'm1.xlarge': dict(memory_mb=16384, vcpus=8, root_gb=160, flavorid=5)}
    class FakeModel(object, ):
        'Stubs    out    for    model.'
        def __init__(self, values):
            self.values = values
        def get(self, key, default=None):
            if (key in self.values):
                return self.values[key]
            else:
                return default
        def __getattr__(self, name):
            return self.values[name]
        def __getitem__(self, key):
            return self.get(key)
        def __setitem__(self, key, value):
            self.values[key] = value
        def __str__(self):
            return str(self.values)
    def fake_instance_create(context, values):
        'Stubs    out    the    db.instance_create    method.'
        if ('instance_type' not in values):
            return
        instance_type = values['instance_type']
        base_options = {'name': values['name'], 'id': values['id'], 'uuid': str(uuid.uuid4()), 'reservation_id': utils.generate_uid('r'), 'image_ref': values['image_ref'], 'kernel_id': values['kernel_id'], 'ramdisk_id': values['ramdisk_id'], 'vm_state': vm_states.BUILDING, 'task_state': task_states.SCHEDULING, 'user_id': values['user_id'], 'project_id': values['project_id'], 'launch_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()), 'instance_type': instance_type, 'memory_mb': instance_type['memory_mb'], 'vcpus': instance_type['vcpus'], 'mac_addresses': [{'address': values['mac_address']}], 'root_gb': instance_type['root_gb']}
        return FakeModel(base_options)
    def fake_instance_type_get_all(context, inactive=0, filters=None):
        return INSTANCE_TYPES.values()
    def fake_instance_type_get_by_name(context, name):
        return...

What's a good function header?
 Here's a good function header?
assistant
#Here's a good function header.

def stub_out_db_instance_api(stubs):