def error_for_code(self, code): primary, secondary, tertiary = str(code) primary = PRIMARY_STATUS_CODES.get(primary, "") secondary = SECONDARY_STATUS_CODES.get(secondary, "") combined = COMBINED_STATUS_CODES.get(primary + secondary, "") return " ".join([primary, secondary, combined]).strip()