Convert given `fn` to base64 and return it. This method does the process
    in not-so-much memory consuming way.

    Args:
        fn (str): Path to the file which should be converted.

    Returns:
        str: File encoded as base64.

def read_as_base64(fn):
    """
    Convert given `fn` to base64 and return it. This method does the process
    in not-so-much memory consuming way.

    Args:
        fn (str): Path to the file which should be converted.

    Returns:
        str: File encoded as base64.
    """
    with open(fn) as unpacked_file:
        with tempfile.TemporaryFile() as b64_file:
            base64.encode(unpacked_file, b64_file)
            b64_file.flush()

            b64_file.seek(0)
            return b64_file.read()