def __init__(self, in_bps, out_bps, link_speed): self.in_bps = in_bps self.out_bps = out_bps self.link_speed = link_speed self.load_in_percent = get_traffic_load_in_percent(in_bps, link_speed) self.rgb = get_traffic_rgb(self.load_in_percent) if self.load_in_percent is not None: self.formatted_load_in_percent = "{0:.2f}".format( self.load_in_percent) else: self.formatted_load_in_percent = None