@classmethod<EOL><INDENT>def fromPy(cls, val, typeObj, vldMask=None):<DEDENT>
vld = int(val is not None)<EOL>if not vld:<EOL><INDENT>assert vldMask is None or vldMask == <NUM_LIT:0><EOL>val = False<EOL><DEDENT>else:<EOL><INDENT>if vldMask == <NUM_LIT:0>:<EOL><INDENT>val = False<EOL>vld = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>val = bool(val)<EOL><DEDENT><DEDENT>return cls(val, typeObj, vld)<EOL>
:param val: value of python type bool or None
:param typeObj: instance of HdlType
:param vldMask: None vldMask is resolved from val,
    if is 0 value is invalidated
    if is 1 value has to be valid