import base64


def save_b64_image(base64_string):
    """Decodes a b64-encoded image and saves it locally to disk
       to be displayed in the Monitoring Station GUI

    Args:
        base64_string (str): encoded image string

    Returns:
        (str): filename for decoded image
    """
    image_bytes = base64.b64decode(base64_string)
    with open("temp-img.jpg", "wb") as out_file:
        out_file.write(image_bytes)
    return "temp-img.jpg"