input: Write a python function to retrieve user data from a PostgreSQL database and return it as a list of dictionaries.
  assert get_users() == [{'user_id': 1, 'username': 'john_doe', 'user_email': 'john@example.com'}, {'user_id': 2, 'username': 'jane_doe', 'user_email': 'jane@example.com'}]
  assert get_users() == [{'user_id': 3, 'username': 'alice', 'user_email': 'alice@example.com'}, {'user_id': 4, 'username': 'bob', 'user_email': 'bob@example.com'}]
  assert get_users() == []
output: import psycopg2
  from psycopg2.extras import RealDictCursor
  
  def get_users():
      try:
          connection = psycopg2.connect(
              dbname="your_database",
              user="your_username",
              password="your_password",
              host="your_host",
              port="your_port"
          )
          cursor = connection.cursor(cursor_factory=RealDictCursor)
          cursor.execute("SELECT user_id, username, user_email FROM users")
          users = cursor.fetchall()
          return [dict(user) for user in users]
      except (Exception, psycopg2.Error) as error:
          print("Error while fetching data from PostgreSQL", error)
          return []
      finally:
          if connection:
              cursor.close()
              connection.close()