human
What is a the Python code you requested given the following:
Complete the below
def get_all_types(context, inactive=0, search_opts={}):

    ''''Get all non-deleted volume_types.
    Pass true as argument if you want deleted volume types returned also.'
    '''
assistant
#Here is the Python code you requested.
    vol_types = db.volume_type_get_all(context, inactive)
    if search_opts:
        LOG.debug((_('Searching    by:    %s') % str(search_opts)))
        def _check_extra_specs_match(vol_type, searchdict):
            for (k, v) in searchdict.iteritems():
                if ((k not in vol_type['extra_specs'].keys()) or (vol_type['extra_specs'][k] != v)):
                    return False
            return True
        filter_mapping = {'extra_specs': _check_extra_specs_match}
        result = {}
        for (type_name, type_args) in vol_types.iteritems():
            for (opt, values) in search_opts.iteritems():
                try:
                    filter_func = filter_mapping[opt]
                except KeyError:
                    continue
                else:
                    if filter_func(type_args, values):
                        result[type_name] = type_args
                        break
        vol_types = result
    return vol_types