input: Write a function to periodically refresh a given table of data in a PostgreSQL database every 5 minutes using a Python script. The function should establish a connection to the PostgreSQL database, execute a refresh query on the specified table, and continuously run the job every 5 minutes. If the database connection fails, the function should handle the exception appropriately.
  assert refresh_data_table('TableName')==None
  assert refresh_data_table('AnotherTable')==None
  assert refresh_data_table('InvalidTableName')==None
  assert refresh_data_table('ValidDB.TableName')==None
  assert refresh_data_table('')==False
output: import psycopg2
  import time
  
  def refresh_data_table(table_name):
      if not table_name:
          return False
      try:
          conn = psycopg2.connect(
              dbname="your_dbname",
              user="your_username",
              password="your_password",
              host="your_host",
              port="your_port"
          )
          cursor = conn.cursor()
          while True:
              cursor.execute(f"REFRESH MATERIALIZED VIEW {table_name};")
              conn.commit()
              time.sleep(300)
      except (Exception, psycopg2.Error) as error:
          print(f"Error: {error}")
      finally:
          if conn:
              cursor.close()
              conn.close()