Write a clean, optimized implementation of a 2D convolution operation in Python without using deep learning libraries.