def _get_target_service_attr_obj(service_instance, target_attr_name):
    """
    get attribute object, includes validation for 2nd gen shell namespace
    :param ServiceInstance service_instance:
    :param str target_attr_name: the name of target attribute. Do not include the prefixed-namespace
    :return ServiceAttribute:
    """
    # Attribute names with 2nd gen name space (using ServiceName)
    target_namespaced_attr = "{service_name}.{attr}".format(service_name=service_instance.ServiceName,
                                                            attr=target_attr_name)

    # check against all possibilities
    target_service_attr_filter = [attr for attr in service_instance.Attributes if attr.Name == target_attr_name
                                  or attr.Name == target_namespaced_attr]
    if target_service_attr_filter:
        return target_service_attr_filter[0]
    else:
        raise AttributeError("'{}' has no attribute '{}'".format(service_instance, target_attr_name))