This function uses a lot of f-strings to output a list nicely. Here is the code:
def return_exp_list_as_str(obj: list[Exponent], fancy: bool = False, brackets: str = "[]", just_print: bool = False) -> str:
output = ""
if fancy:
try:
output += f"{brackets[0]}"...