diff --git a/core/includes/module.inc b/core/includes/module.inc
index c1d99f2..db59b72 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -1182,6 +1182,30 @@ function drupal_alter($type, &$data, &$context1 = NULL, &$context2 = NULL) {
 }
 
 /**
+ * Gets weight of a particular module.
+ *
+ * @param string $module
+ *   The name of the module (without the .module extension).
+ *
+ * @return integer
+ *   The configured weight of the module.
+ *
+ * @throws InvalidArgumentException
+ *   Thrown in case the given module is not installed in the system.
+ */
+function module_get_weight($module) {
+  $weight = config('system.module')->get("enabled.$module");
+  if ($weight !== NULL) {
+    return (int) $weight;
+  }
+  $weight = config('system.module.disabled')->get($module);
+  if ($weight !== NULL) {
+    return (int) $weight;
+  }
+  throw new InvalidArgumentException(format_string('The module %module is not installed.', array('%module' => $module)));
+}
+
+/**
  * Sets weight of a particular module.
  *
  * The weight of uninstalled modules cannot be changed.
