def _transform_master_key_providers(key_id, regions, profile):
    """Transform master key provider information to raw aws-encryption-cli arguments.

    :param str key_id: Key ID to use for all regions
    :param list regions: List of region names (may be empty)
    :param str profile: Named profile to use (may be None)
    :returns: Raw aws-encryption-cli master key provider configuration arguments
    :rtype: list of str
    """
    base_config = ['--master-keys', 'key={}'.format(key_id)]
    if profile is not None:
        base_config.append('profile={}'.format(profile))
    if not regions:
        return base_config
    configs = []
    for region in regions:
        configs.extend(base_config + ['region={}'.format(region)])
    return configs
