def mask_landsat8_sr(image):
    """Mask clouds and cloud shadows in Landsat surface reflectance image.

    Obtained from:
        https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LC08_C01_T2_SR

    Parameters
    ----------
    image : ee.Image
        Input image (Landsat 8 Surface Reflectance).

    Returns
    -------
    N/A : ee.Image
        Input image masked for clouds and cloud shadows.

    Example
    -------
        >>> import ee
        >>> peak_green = ee.Image('LANDSAT/LC08/C01/T1_SR/LC08_008057_20170602'
        >>> peak_green_mask = mask_landsat8_sr(peak_green)
    """
    # Define cloud (5) and cloud shadow (3) mask bits
    cloud_shadow_bit_mask = (1 << 3)
    cloud_bit_mask = (1 << 5)

    # Get the pixel QA band
    qa = image.select('pixel_qa')

    # Mask image, based on both bit masks == 0
    mask = qa.bitwiseAnd(cloud_shadow_bit_mask).eq(
        0) and qa.bitwiseAnd(cloud_bit_mask).eq(0)

    # Return masked image
    return image.updateMask(mask)