Toggling visibility of geometry with a keyboard press

What is the simplest way to toggle on and off the visibility of a piece of geometry in a scene via a keyboard press? Ideally, press it once for on, and once more for off.

My object’s name is “Object_1”.

Scripting newbie, so any help you can give would be super helpful.

Can you attach the script directly to the mesh renderer?

/// Toggle renderer on this.gameObject when key is pressed down.
public class ToggleRenderer : MonoBehaviour
{
  void Update()
  {
    if (Input.anyKeyDown)
      renderer.enabled = !renderer.enabled;
  }
}