diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index b536b08..d7655a7 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -907,6 +907,32 @@ function taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $load_entities
 }
 
 /**
+ * Get all the terms attached to a given entity.
+ *
+ * @param $entity
+ *   The entity to check for terms.
+ * @param $type
+ *   The type of the entity to be checked.
+ *
+ * @return
+ *   A array of term objects keyed on their tid.
+ */
+function taxonomy_get_entity_terms($entity, $type) {
+  $terms = array();
+
+  foreach (element_children($entity->content) as $key) {
+    if (array_key_exists('#field_type', $entity->content[$key]) && $entity->content[$key]['#field_type'] == 'taxonomy_term_reference') {
+      $entity_terms = field_view_field($type, $entity, $key);
+      foreach ($entity_terms['#items'] as $item) {
+        $terms[$item['tid']] = $item['taxonomy_term'];
+      }
+    }
+  }
+
+  return $terms;
+}
+
+/**
  * Try to map a string to an existing term, as for glossary use.
  *
  * Provides a case-insensitive and trimmed mapping, to maximize the
