def default_lgs(lg_zone_ids, controller_zone_id: str): if isinstance(lg_zone_ids, dict) and len(lg_zone_ids) > 0: return lg_zone_ids lgs = '1' if lg_zone_ids is None or lg_zone_ids == {} else lg_zone_ids if tools.is_integer(lgs): return parse_zone_ids(lgs, controller_zone_id) return parse_zone_ids(lg_zone_ids, controller_zone_id)
def parse_zone_ids(lg_zone_ids, controller_zone): if tools.is_integer(lg_zone_ids): return {default_zone(controller_zone): int(lg_zone_ids)} values = {} for zone in lg_zone_ids.split(","): split = zone.split(":") values[split[0].strip()] = split[1].strip() return values