import xmlrpclib


class Remote:
    
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'

    def __init__(self, uri='http://localhost:8270'):
        if '://' not in uri:
            uri = 'http://' + uri
        self._library = xmlrpclib.Server(uri)  #.robotframework

    def get_keyword_names(self):
        # TODO: Support also getKeywordNames (and runKeyword etc.)
        return self._library.get_keyword_names()

    def get_keyword_arguments(self, name):
        # TODO: Handle errors
        return self._library.get_keyword_arguments(name)

 #   def get_keyword_documentation(self, name):
 #       return self._library.get_keyword_documentation(name)

    def run_keyword(self, name, args):
        try:
            result = self._library.run_keyword(name, args)
        except xmlrpclib.Fault, err:
            raise RuntimeError(err.faultString)
        print result['output']
        if result['status'] != 'PASS':
            raise AssertionError(result['message'])
        return result['return']

@@ -530,17 +530,16 @@
 name)%0A%0A 
-#
    def g
@@ -577,17 +577,16 @@
 name):%0A 
-#
        r
@@ -677,16 +677,78 @@
  args):%0A
+        args = %5B self._handle_argument(arg) for arg in args %5D%0A
         
@@ -1050,8 +1050,429 @@
 eturn'%5D%0A
+%0A    def _handle_argument(self, arg):%0A        if isinstance(arg, (basestring, int, long, float, bool)):%0A            return arg%0A        if isinstance(arg, (tuple, list)):%0A            return %5B self._handle_argument(item) for item in arg %5D%0A        if isinstance(arg, dict):%0A            return dict(%5B (str(key), self._handle_argument(value))%0A                          for key, value in arg.items() %5D)%0A        return str(arg)%0A

handle args to executed keywords