code: def validate_endpoint(ctx, param, value):
      
      try:
          config = ctx.obj['config']
      except Exception:
          return
  
      endpoint = default_endpoint(ctx, param, value)
  
      if endpoint not in config.get('endpoints', {}):
          raise click.UsageError('Unknown endpoint: {0}'.format(endpoint))
  
      return endpoint
docs: Validate endpoint.