'PostgreSQL psycopg2 driver  accepts two syntaxes
Plus a string for .pgpass file'

def postgresql(self, dbhost, dbport, dbname, dbuser, dbpass, dsn_style=None):

    dsn = []
    if ((dsn_style is None) or (dsn_style == 'all') or (dsn_style == 'keyvalue')):
        dsnstr = "host='{0}'    dbname='{2}'    user='{3}'    password='{4}'"
        if (dbport is not None):
            dsnstr += "    port='{1}'"
        dsn.append(dsnstr.format(dbhost, dbport, dbname, dbuser, dbpass))
    if ((dsn_style == 'all') or (dsn_style == 'kwargs')):
        dsnstr = "host='{0}',    database='{2}',    user='{3}',    password='{4}'"
        if (dbport is not None):
            dsnstr += ",    port='{1}'"
        dsn.append(dsnstr.format(dbhost, dbport, dbname, dbuser, dbpass))
    if ((dsn_style == 'all') or (dsn_style == 'uri')):
        if (dbport is not None):
            dsnstr = 'postgresql://{3}:{4}@{0}:{1}/{2}'
        else:
            dsnstr = 'postgresql://{3}:{4}@{0}/{2}'
        dsn.append(dsnstr.format(dbhost, dbport, dbname, dbuser, dbpass))
    if ((dsn_style == 'all') or (dsn_style == 'pgpass')):
        if (dbport is not None):
            dbport = 5432
        dsn.append('{0}:{1}:{2}:{3}:{4}'.format(dbhost, dbport, dbname, dbuser, dbpass))
    return dsn
