def is_attr_private(attrname):
 regex = re.compile('^_{2,}.*[^_]+_?$')
 return regex.match(attrname)

def is_attr_private ( attrname ) : regex = re . compile ( '^_{2,}.*[^_]+_?$' ) return regex . match ( attrname )
check that attribute name is private .