def extract_options(options, prefix):
    """extract_options(dict(law=0, law_a=1, law_b=2, foo=3, foo_c=4), 'law') == {'a': 1, 'b': 2}"""
    return {k.replace(prefix+'_', ""):options[k] for k in options if k.find(prefix+'_')==0}