input: Write a python function to connect to a PostgreSQL database, create a table, insert a record, and retrieve the data.
  assert retrieve_data() == [(1, 'user1', 'password1')]
output: def retrieve_data():
      import psycopg2
      try:
          # Connect to your postgres DB
          conn = psycopg2.connect("dbname='yourdbname' user='yourusername' host='localhost' password='yourpassword'")
          
          # Open a cursor to perform database operations
          cur = conn.cursor()
          
          # Create table
          cur.execute('''
              CREATE TABLE IF NOT EXISTS users (
                  id SERIAL PRIMARY KEY,
                  username VARCHAR(50) NOT NULL,
                  password VARCHAR(50) NOT NULL
              )
          ''')
          
          # Insert a record
          cur.execute("INSERT INTO users (username, password) VALUES (%s, %s) ON CONFLICT DO NOTHING", ('user1', 'password1'))
          
          # Commit the changes
          conn.commit()
          
          # Retrieve data
          cur.execute("SELECT * FROM users")
          rows = cur.fetchall()
          
          # Close communication with the database
          cur.close()
          conn.close()
          
          return rows
      
      except Exception as e:
          print(f"An error occurred: {e}")
          return []