import io
import base64


def file_to_base64(path):
    """
    Convert specified file to base64 string

    Args:
        path (string): path to file

    Returns:
        string: base64 encoded file content

    Raises:
        Exception of all kind if something wrong occured
    """
    with io.open(path, u'rb') as file_to_convert:
        return base64.b64encode(file_to_convert.read()).decode('utf-8')