def add_to_format(existing_format, dict_of_properties, workbook):
    """Give a format you want to extend and a dict of the properties you want to
    extend it with, and you get them returned in a single format"""
new_dict = {}
for key, value in existing_format.__dict__.items():
    if value != 0 and value != {} and value != None:
        new_dict[key] = value
del new_dict['escapes']
return workbook.add_format(dict(list(new_dict.items()) + list(dict_of_properties.items())))
python XlsxWriter set border around multiple cells