@classmethod
def connect_postgres(cls, host='', username='', password='', port=5432,
    database='', **kwargs):
    """
        Initializes a PostgreSQL connection with the provided credentials.

        @param host -- the host to connect to (default Unix Socket)
        @param username -- the username to login as (optional)
        @param password -- the password to login with (optional)
        @param port -- the port to connect to (default 5432)
        @param database -- the name of the database to connect to (optional)
        """
    try:
        import psycopg2
    except ImportError:
        raise ImportError('Please install the mysql-python package')
    connection = psycopg2.connect(host=host, user=username, password=
        password, port=port, database=database, **kwargs)
    c = connection.cursor()
    return cls(connection, c)
