@classmethod<EOL><INDENT>def fromPy(cls, val, typeObj, vldMask=None):<DEDENT>
assert isinstance(val, str) or val is None<EOL>vld = <NUM_LIT:0> if val is None else <NUM_LIT:1><EOL>if not vld:<EOL><INDENT>assert vldMask is None or vldMask == <NUM_LIT:0><EOL>val = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>if vldMask == <NUM_LIT:0>:<EOL><INDENT>val = "<STR_LIT>"<EOL>vld = <NUM_LIT:0><EOL><DEDENT><DEDENT>return cls(val, typeObj, vld)<EOL>
:param val: python string or None
:param typeObj: instance of String HdlType
:param vldMask: if is None validity is resolved from val
    if is 0 value is invalidated
    if is 1 value has to be valid