def _make_sql_url(hostname, database, **kwargs):
    """Build a URL for SQLAlchemy"""
    url = hostname
    if kwargs.get("port"):
        url = "{}:{}".format(url, kwargs["port"])
    if kwargs.get("user"):
        credentials = kwargs["user"]
        if kwargs.get("password"):
            credentials = "{}:{}".format(credentials, kwargs["password"])
        url = "{}@{}".format(credentials, url)
    return "postgresql://{}/{}".format(url, database)