def black_percentage(rgb):
  """
  rgb: rgb tuple of a pixel
  returns: pixel percentage of black
  """
  if isinstance(rgb, int):
    return 100 - rgb
  return 100 - (int((((rgb[0] + rgb[1] + rgb[2])/3)*100)/255))