def privatize_name(cls_name, name):
    """Privatize an attribute name if necessary."""
    if name.startswith('__') and not name.endswith('__'):
        return '_{}{}'.format(cls_name.lstrip('_'), name)
    return name
