def get_color(mode, image_file, color):
    '''Returns padding color that matches the mode of the original image.
    
    Retuns None if the original image was not an RGB or RGBA image.
    
    '''
    if mode.upper() == "RGBA":
        out_color = color
    elif mode.upper() == "RGB":
        if color[3] == 255:
            logging.info("'%s' not RGBA, falling back to black border..." %
                         (os.path.basename(image_file)))
        out_color = color[0:2]
    else:
        return None
    return out_color
Returns padding color that matches the mode of the original image.
    
    Retuns None if the original image was not an RGB or RGBA image.
    
    
recipes/Python/576416_Pad_images_poweroftwo/recipe-576416.py