code: def cli(obj, username, scopes, duration, text, customer, delete):
      
      client = obj['client']
      if delete:
          client.delete_key(delete)
      else:
          try:
              expires = datetime.utcnow() + timedelta(seconds=duration) if duration else None
              key = client.create_key(username, scopes, expires, text, customer)
          except Exception as e:
              click.echo('ERROR: {}'.format(e))
              sys.exit(1)
          click.echo(key.key)
docs: Create or delete an API key.