Capture image on custom key combination

I have a short script to start camera on laptop. I want to start to capture image or record only when user customised key combination is used. Can anyone suggest how to get this done ? I have read the cv2.waitkey library but could not get a clear idea of this. See current snippet below;

import cv2

key = cv2. waitKey(1)
cmra = cv2.VideoCapture(0)
while True:
try:
camera_avail, frame = cmra.read()
print(camera_avail) # true if cmra is running
print(frame) # matrix values per frame
cv2.imshow(“streaming frame”, frame)
key = cv2.waitKey(1)
print(‘KEY: {}\nORD S: {}’.format(key, ord(‘s’)))
#print(CHECK)
if key == ord(‘s’):
cv2.imwrite(filename=‘rgb_img.jpg’, img=frame)
cmra.release()
img_new = cv2.imread(‘rgb_img.jpg’, cv2.IMREAD_GRAYSCALE)
img_new = cv2.imshow(“Captured Image”, img_new)
cv2.waitKey(3000)
cv2.destroyAllWindows()