# Path: djenga/encryption/helpers.py
# def _as_bytes(value):
#     if isinstance(value, six.string_types):
#         value = value.encode('utf-8')
#     return value
# 
# Path: djenga/encryption/helpers.py
# def b64_str(value: bytes):
#     return b64encode(value).decode('utf-8')
# 
# Path: djenga/encryption/helpers.py
# def from_b64_str(value: str):
#     value = value.encode('utf-8')
#     return b64decode(value)
# 
# Path: djenga/encryption/helpers.py
# def _get_client(region: str = None, profile: str = None):
#     key = f'{region}-{profile}'
#     client = thread_local.sessions.get(key)
#     if not client:
#         session = boto3.Session(region_name=region, profile_name=profile)
#         client = session.client('kms')
#         thread_local.sessions[key] = client
#     return client
# 
# Path: djenga/encryption/helpers.py
# def _prefix_alias(alias: str):
#     if not alias.startswith('alias/'):
#         alias = f'alias/{alias}'
#     return alias


from .helpers import _as_bytes
from .helpers import b64_str
from .helpers import from_b64_str
from .helpers import _get_client
from .helpers import _prefix_alias


def encrypt_bytes(
        plain_text: bytes
        , alias: str
        , region: str = None
        , profile: str = None) -> bytes:
    client = _get_client(region, profile)

# Path: djenga/encryption/helpers.py
# def _as_bytes(value):
#     if isinstance(value, six.string_types):
#         value = value.encode('utf-8')
#     return value
# 
# Path: djenga/encryption/helpers.py
# def b64_str(value: bytes):
#     return b64encode(value).decode('utf-8')
# 
# Path: djenga/encryption/helpers.py
# def from_b64_str(value: str):
#     value = value.encode('utf-8')
#     return b64decode(value)
# 
# Path: djenga/encryption/helpers.py
# def _get_client(region: str = None, profile: str = None):
#     key = f'{region}-{profile}'
#     client = thread_local.sessions.get(key)
#     if not client:
#         session = boto3.Session(region_name=region, profile_name=profile)
#         client = session.client('kms')
#         thread_local.sessions[key] = client
#     return client
# 
# Path: djenga/encryption/helpers.py
# def _prefix_alias(alias: str):
#     if not alias.startswith('alias/'):
#         alias = f'alias/{alias}'
#     return alias


# Path: djenga/encryption/kms.py
from .helpers import _as_bytes
from .helpers import b64_str
from .helpers import from_b64_str
from .helpers import _get_client
from .helpers import _prefix_alias



def encrypt_bytes(
        plain_text: bytes
        , alias: str
        , region: str = None
        , profile: str = None) -> bytes:
    client = _get_client(region, profile)

    alias = _prefix_alias(alias)