def mask_sentinel_clouds(img):
    """
    Function that masks out clouds from the input Sentinel-2 image. The
    input image has to have the QA60 band in its bands list.

    Parameters
    ----------
    img : ee.image.Image
        Single Sentinel-2 Earth Engine Image that needs cloud-masking

    Returns
    -------
    ee.image.Image
        The cloud-masked image
    """

    try:
        # selecting the qa band
        qa = img.select('QA60')

        # Bits 10 belong to clouds, bits 11 belong to cirrus
        cloudBitMask = 1 << 10
        cirrusBitMask = 1 << 11

        # Setting flags to 0 to indicate no cloudy condtions
        mask = qa.bitwiseAnd(cloudBitMask).eq(0) \
            .And(qa.bitwiseAnd(cirrusBitMask).eq(0))

        return img.updateMask(mask).divide(10000)

    # The function will return an error message if the input is not
    # of type <class 'ee.image.Image'>
    except AttributeError:
        print("""
        Error: the input is {}. It needs to be a <class 'ee.image.Image'>
        """.format(str(type(img))))
        return None