def build_readable_attribute_key(key: str, attribute_name: str):
    """
    Formatting nested attribute name to be more readable, and convenient to display in fetch incident command.
    For the input of "srcIpAddr", "incidentSrc" the formatted key will be: "source_ipAddr".
    Args:
         key: (str): The that was extracted from the original incident attribute vale.
         attribute_name (str): The original incident attribute.
    Returns:
        str: Formatted key.
    """
    key_prefix = ''  # for better readable layout in the incident source&target.
    key_suffix = ''
    if 'Src' in attribute_name:
        key_prefix = 'source_'
    elif 'Target' in attribute_name:
        key_prefix = 'target_'

    if key_prefix:
        if 'ipaddr' in key.lower():
            key_suffix = 'ipAddr'
        elif 'hostname' in key.lower():
            key_suffix = 'hostName'
        else:
            key_suffix = key
    else:
        key_suffix = key  # prefix is empty
    return key_prefix + key_suffix