HELP! Arithmetic formatter, don´t know how to fix it

Hello, I’ve been working with this problem on my IDE and it function the right way, but when i put my code in the test it doesnt pass two test. I think my problem is that for some reason when i print the output it prints a 'None' next to the right output, but i dont know how to fix it. Does anyone knows who to fix it? thanks, here is my code:

def arithmetic_arranger(problems, answer = False):

  if len(problems) > 5:
    return('Error: Too many problems.')

  firsts, operators, seconds, lengths, answers = [], [], [], [], []

  for op in problems:
    s_op = op.split()
    if len(s_op[0]) > 4 or len(s_op[2]) > 4:
      return('Error: Numbers cannot be more than four digits.')
    else:
      firsts.append(s_op[0])
      operators.append(s_op[1])
      seconds.append(s_op[2])

  for i in range(len(problems)):
    if not firsts[i].isdigit() or not seconds[i].isdigit():
      return('Error: Numbers must only contain digits.')

  valids_op =['+', '-']
  op_status = [-1 for i in operators if i not in valids_op]
  if -1 in op_status:
    return('''Error: Operator must be '+' or '-'.''')

  for x, y in zip(firsts, seconds):
    lengths.append(max((len(x), len(y))) + 2)

  for i in range(len(problems)):
    if operators[i] == '+':
      answers.append(str(int(firsts[i]) + int(seconds[i])))
    if operators[i] == '-':
      answers.append(str(int(firsts[i]) - int(seconds[i])))

  for i in range(len(problems)):
    if i < len(problems) - 1:
      print(firsts[i].rjust(lengths[i]), end='    ')
    else:
      print(firsts[i].rjust(lengths[i]), end='')
  print('')
  for i in range(len(problems)):
    if i < len(problems) - 1:
      print(f'{operators[i].ljust(lengths[i] - len(seconds[i]) - 1)} {seconds[i].rjust(1)}', end='    ')
    else:
      print(f'{operators[i].ljust(lengths[i] - len(seconds[i]) - 1)} {seconds[i].rjust(1)}', end='')
  print('')
  for i in range(len(problems)):
    if i < len(problems) - 1:
      print ('-' * lengths[i], end='    ')
    else:
      print('-' * lengths[i], end='')
  if answer:
    print('')
    for i in range(len(problems)):
      if i < len(problems) - 1:
        print(answers[i].rjust(lengths[i]), end='    ')
    else:
      print(answers[i].rjust(lengths[i]), end='')

my replit url for the problem is: https://replit.com/@DanielPrez10/boilerplate-arithmetic-formatter-1#arithmetic_arranger.py

You need to return a string with the correct information, not print the data out.