From 8930e72cc390c9920b1a8dc4a06a1cec87948bbc Mon Sep 17 00:00:00 2001 From: Sam Cornwell <14048146+samcornwell@users.noreply.github.com> Date: Sun, 19 Nov 2017 22:11:44 -0500 Subject: [PATCH] added get_type_from_id function to utils --- stix2/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stix2/utils.py b/stix2/utils.py index f23dbe2..960b89e 100644 --- a/stix2/utils.py +++ b/stix2/utils.py @@ -255,3 +255,6 @@ def get_class_hierarchy_names(obj): for cls in obj.__class__.__mro__: names.append(cls.__name__) return names + +def get_type_from_id(stix_id): + return stix_id.split('--', 1)[0]