def options_dictionary_to_string(options_dictionary):
    """Given a dictionary, returns a string in the form:

    "\x00KEY1\x00VALUE1\x00KEY2\x00VALUE2\x00...\x00"

    Sorted in order of key
    """
    ops = []
    for (key, value) in sorted(options_dictionary.iteritems()):
        ops.append(key)
        ops.append(value)
    ops_string = "\x00".join(ops)
    ops_string +=  "\x00" if ops else ""
    return ops_string