docs: def to_array(self):
          """
          Convert the RiakMapReducePhase to a format that can be output
          into JSON. Used internally.
  
          :rtype: dict
          """
          stepdef = {'keep': self._keep,
                     'language': self._language,
                     'arg': self._arg}
  
          if self._language == 'javascript':
              if isinstance(self._function, list):
                  stepdef['bucket'] = self._function[0]
                  stepdef['key'] = self._function[1]
              elif isinstance(self._function, string_types):
                  if ("{" in self._function):
                      stepdef['source'] = self._function
                  else:
                      stepdef['name'] = self._function
  
          elif (self._language == 'erlang' and isinstance(self._function, list)):
              stepdef['module'] = self._function[0]
              stepdef['function'] = self._function[1]
  
          elif (self._language == 'erlang' and
                isinstance(self._function, string_types)):
              stepdef['source'] = self._function
  
          return {self._type: stepdef}