def get_valid_node(node):
    try:
        PyNode = pm.PyNode(node)
    except pm.MayaNodeError:
        print('Error: no node named : %s' % node)
        return None

    return PyNode
returns a valid PyNode even the input is string
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/auxiliary.py/get_valid_node