input: Write a function to print the following pattern: a pyramid of asterisks with 5 levels, followed by a reverse pyramid of asterisks with 5 levels. If the given number of levels is less than 1, then print nothing.
  assert generate_pattern(5)
  assert generate_pattern(0)==None
  assert generate_pattern(-1)==None
output: def generate_pattern(levels):
      if levels < 1:
          return
      for i in range(1, levels + 1):
          print(' ' * (levels - i) + '*' * (2 * i - 1))
      for i in range(levels - 1, 0, -1):
          print(' ' * (levels - i) + '*' * (2 * i - 1))