from typing import Dict
from typing import Any


def get_asset_custom_context_for_whois(resp: Dict[str, Any], whois_content: Dict[str, Any]) -> Dict[str, Any]:
    """
    Modifying the lists fetched from whois details of response to comma separated strings.

    :param resp: Response fetched from the API call
    :param whois_content: Whois content after reducing heirarchy and excluding keys.
    :return: whois_content: Custom context prepared for the whois details for the fetched response
    """

    asset = resp.get('asset', {}).get('whois', {})
    if asset.get('contactCountries'):
        whois_content['contactCountries'] = \
            ', '.join(asset.get('contactCountries', []))

    if asset.get('contactOrganizations'):
        whois_content['contactOrganizations'] = \
            ', '.join(asset.get('contactOrganizations', []))

    if asset.get('contactEmails'):
        whois_content['contactEmails'] = \
            ', '.join(asset.get('contactEmails', []))

    if asset.get('contactNames'):
        whois_content['contactNames'] = \
            ', '.join(asset.get('contactNames', []))

    if asset.get('nameservers'):
        whois_content['nameservers'] = \
            ', '.join(asset.get('nameservers', []))

    return whois_content