input: Write a python function to parse an XML file, extract person information, and insert it into a PostgreSQL database. 
  assert parse_and_insert('data.xml') == True
output: import xml.etree.ElementTree as ET
  import psycopg2
  
  def parse_and_insert(filename):
      try:
          tree = ET.parse(filename)
          root = tree.getroot()
          
          # Connect to the PostgreSQL database
          conn = psycopg2.connect(
              dbname="your_database",
              user="your_user",
              password="your_password",
              host="your_host",
              port="your_port"
          )
          cursor = conn.cursor()
          
          for person in root.findall('person'):
              name = person.find('name').text
              age = int(person.find('age').text)
              city = person.find('city').text
              
              cursor.execute(
                  "INSERT INTO persons (name, age, city) VALUES (%s, %d, %s)",
                  (name, age, city)
              )
          
          conn.commit()
          cursor.close()
          conn.close()
          return True
      except Exception as e:
          print(f"An error occurred: {e}")
          return False