from typing import Union
import shlex


def parse_code_package_config(config) -> Union[dict, bool]:
    """
    Parse the code package options from a AWSBatchExecutor config.
    """
    if not config.getboolean("code_package", fallback=True):
        return False

    include_config = config.get("code_includes", "**/*.py")
    exclude_config = config.get("code_excludes", "")

    return {"includes": shlex.split(include_config), "excludes": shlex.split(exclude_config)}