def METHOD_NAME(self, attr_name, model):
    """For a related attribute specification, returns (related model,
    attribute).
    Returns (None, None) if model is not found, or (model, None) if
    attribute is not found.
    """
    rel_attr_name, attr_name = attr_name.split(".", 1)
    rel_attr = getattr(self.model, rel_attr_name, None)
    rel_model = None
    attr = None
    if rel_attr is not None:
        rel_model = rel_attr.property.mapper.class_
        attr = getattr(rel_model, attr_name, None)
    return rel_model, attr