@staticmethod
  def dump(props, output):
    def escape(token):
      return re.sub(r'([=:\s])', r'\\\1', token)

    def write(out):
      for k, v in props.items():
        out.write('%s=%s\n' % (escape(str(k)), escape(str(v))))

    if hasattr(output, 'write') and callable(output.write):
      write(output)
    elif isinstance(output, six.string_types):
      with open(output, 'w+a') as out:
        write(out)
    else:
      raise TypeError('Can only dump data to a path or a writable object, given: %s' % output)
1 2 4
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/backend/jvm/tasks/properties.py/Properties.dump--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/lxml-3.3.6/benchmark/bench_objectify.py/BenchMark.bench_attribute