import base64


def image_file_to_b64_string(filename):

    """Convert image file to base64 string.

        This function converts image file to base64 string.

        Args:
            filename (string): the path and name of the
            image file on computer

        Returns:
            b64_string (string): image bytes encoded
            as a base64 string

        """

    with open(filename, "rb") as image_file:
        b64_bytes = base64.b64encode(image_file.read())
    b64_string = str(b64_bytes, encoding='utf-8')
    return b64_string