def mergeOptions(defaults, options):
    """Returns a dictionary where options are merged into the defaults""" 
    merged_options = defaults.copy()
    for key, val in options.iteritems():
        if key in merged_options:
            merged_options[key] = val
    return merged_options