import copy


def zero_pad(img, pwx, pwy):
    """Pads a given image with zero at the border."""
    
    padded_img = copy.deepcopy(img) 
    
    """
    Let's assume, padded_img = [ [1,1,1],
                                 [1,1,1],
                                 [1,1,1]
                               ]
    """
    
    for i in range(pwx):
        padded_img.insert(0, [0 for value in enumerate(padded_img[i])])                 # add a row of 0 in the top
        padded_img.insert(len(padded_img), [0 for value in enumerate(padded_img[-1])])  # add a row of 0 in the bottom
    
    """
    Now, padded_img = [ [0,0,0]
                        [1,1,1],
                        [1,1,1],
                        [1,1,1],
                        [0,0,0]
                      ]
    """
     
    
    for i, row in enumerate(padded_img):
        for j in range(pwy):
            row.insert(0, 0)             # add a 0 in the beginning of each row
            row.insert(len(row), 0)      # add a 0 in the ending of each row
    
    """
    Now, padded_img = [ [0, 0,0,0, 0]
                        [0, 1,1,1, 0],
                        [0, 1,1,1, 0],
                        [0, 1,1,1, 0],
                        [0, 0,0,0, 0]
                      ]
    """
    return padded_img