--- common.inc	2010-12-20 17:46:07.739000003 +0100
+++ common.inc.new	2010-12-20 17:50:28.195000001 +0100
@@ -6948,6 +6948,34 @@
   return $info;
 }
 
+
+/**
+ * Gernerates an info file that can be parsed by drupal_parse_info_file.
+ * @param array $array
+ *   What is returned from drupal_parse_info_file().
+ * @param string $prefix
+ *   A string to prefix each entry with, should be used only by the function itself
+ *   during recursion.
+ *
+ * @return string
+ *   A string corresponding to $array in the info format. If written into a file, it can be parsed back by drupal_parse_info_file
+ *
+ */
+function drupal_build_info_file($array, $prefix = false) {
+  $info = '';
+  foreach ($array as $key => $value) {
+    if (is_array($value)) {
+      $info .= drupal_build_info_file($value, (!$prefix ? $key : "{$prefix}[{$key}]" ));
+    }
+    else {
+      $info .= $prefix ? ("{$prefix}[" . (is_int($key) ? '' : $key) .']') : $key;
+      $info .= " = '" . str_replace("'", "\'", $value) . "'\n";
+    }
+  }
+  return $info;
+}
+
+
 /**
  * Severity levels, as defined in RFC 3164: http://www.ietf.org/rfc/rfc3164.txt.
  *
