def get_json_field(json_obj, attribute_name, json_filename=None,
                   suppress_err_msg=False):
    """Retrieves a value from a JSON object (dict).
    Args:
        json_obj (dict): The JSON file to retrieve a value from.
        attribute_name (str): The attribute to look up. If there are nested
            structures expressed within the attribute_name, they should be
            separated by periods. Consequently, attribute names and nested
            names cannot contain periods.
        json_filename (Optional[str]): The name of the JSON file the attribute
            is read from. This will be included in error messages. Default is
            `None`.
        suppress_err_msg (Optional[bool]): Specifies whether an error message
            will be printed to stdout if an error condition is met. By default,
            error messages will be printed.
    Raises:
        KeyError: If the specified `attribute_name` does not exist in the JSON.
    """
    while '.' in attribute_name:
        attrib_as_list = attribute_name.split('.')
        attrib_name_single = attrib_as_list.pop(0)
        try:
            json_obj = json_obj[attrib_name_single]
        except KeyError:
            if not suppress_err_msg:
                error_suffix = '.'
                if json_filename is not None:
                    error_suffix = " '%s'." % json_filename
                print("Attribute '%s' not found in preferences file%s" %
                      (attrib_name_single, error_suffix))
            raise
        attribute_name = '.'.join(attrib_as_list) #no period included for len 1
    return json_obj[attribute_name]