input: Write a function to refresh a given table of data in a PostgreSQL database every 5 minutes.
  assert refresh_data('TableName')
  assert refresh_data('AnotherTableName')
output: def refresh_data(table_name):
      import psycopg2
      import time
      from datetime import datetime, timedelta
  
      conn = psycopg2.connect(
          dbname="your_dbname",
          user="your_username",
          password="your_password",
          host="your_host",
          port="your_port"
      )
      cursor = conn.cursor()
  
      next_refresh = datetime.now()
      while True:
          if datetime.now() >= next_refresh:
              cursor.execute(f"REFRESH MATERIALIZED VIEW {table_name};")
              conn.commit()
              next_refresh = datetime.now() + timedelta(minutes=5)
          time.sleep(1)