def make_client(host, project_name, api_key, create_project):
    """ Instantiate the grano client based on environment variables or
    command line settings. """
    if host is None:
        raise click.BadParameter('No grano server host is set', param=host)
    if project_name is None:
        raise click.BadParameter('No grano project slug is set',
                                 param=project_name)
    if api_key is None:
        raise click.BadParameter('No grano API key is set', param=api_key)

    client = Grano(api_host=host,
                   api_key=api_key)
    try:
        return client.get(project_name)
    except NotFound:
        if not create_project:
            sys.exit(-1)
        data = {'slug': project_name, 'label': project_name}
        return client.projects.create(data)
Instantiate the grano client based on environment variables or
    command line settings.