'Unpack ord(Py_UNICODE) and ord(\'X\').'

def _handle_simple_function_ord(self, node, function, pos_args):

    if (len(pos_args) != 1):
        return node
    arg = pos_args[0]
    if isinstance(arg, ExprNodes.CoerceToPyTypeNode):
        if arg.arg.type.is_unicode_char:
            return ExprNodes.TypecastNode(arg.pos, operand=arg.arg, type=PyrexTypes.c_long_type).coerce_to(node.type, self.current_env())
    elif isinstance(arg, ExprNodes.UnicodeNode):
        if (len(arg.value) == 1):
            return ExprNodes.IntNode(arg.pos, type=PyrexTypes.c_int_type, value=str(ord(arg.value)), constant_result=ord(arg.value)).coerce_to(node.type, self.current_env())
    elif isinstance(arg, ExprNodes.StringNode):
        if (arg.unicode_value and (len(arg.unicode_value) == 1) and (ord(arg.unicode_value) <= 255)):
            return ExprNodes.IntNode(arg.pos, type=PyrexTypes.c_int_type, value=str(ord(arg.unicode_value)), constant_result=ord(arg.unicode_value)).coerce_to(node.type, self.current_env())
    return node
