<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect(host=None, database=None, user=None, password=None, **kwargs):
 """Create a database connection."""


    host = host or os.environ['PGHOST']
    database = database or os.environ['PGDATABASE']
    user = user or os.environ['PGUSER']
    password = password or os.environ['PGPASSWORD']

    return psycopg2.connect(host=host,
                            database=database,
                            user=user,
                            password=password,
                            **kwargs)