trace2_event: Add remove_prefix to fix failing tests on Linux & macOS.

removeprefix is available i python 3.9. Mac and Linux are running in
a version below 3.9. Thus tests are failing with the following error:
  "AttributeError: 'str' object has no attribute 'removeprefix' "

Replaced the removeprefix with custom function which we will delete
once Linux and macOS versions are updated.

Tested:
$ ./run_tests

Bug: [google internal] b/201453085
Change-Id: I9b4d564ff1176e1b4471805ef05472c1914cd9f9
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/319375
Tested-by: Raman Tenneti <rtenneti@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
diff --git a/tests/test_git_trace2_event_log.py b/tests/test_git_trace2_event_log.py
index 7bd21e2..89dcfb9 100644
--- a/tests/test_git_trace2_event_log.py
+++ b/tests/test_git_trace2_event_log.py
@@ -66,6 +66,13 @@
         log_data.append(json.loads(line))
     return log_data
 
+  def remove_prefix(self, s, prefix):
+    """Return a copy string after removing |prefix| from |s|, if present or the original string."""
+    if s.startswith(prefix):
+        return s[len(prefix):]
+    else:
+        return s
+
   def test_initial_state_with_parent_sid(self):
     """Test initial state when 'GIT_TRACE2_PARENT_SID' is set by parent."""
     self.assertRegex(self._event_log_module.full_sid, self.FULL_SID_REGEX)
@@ -265,7 +272,8 @@
       # Check for 'data' event specific fields.
       self.assertIn('key', event)
       self.assertIn('value', event)
-      key = event['key'].removeprefix(f'{prefix_value}/')
+      key = event['key']
+      key = self.remove_prefix(key, f'{prefix_value}/')
       value = event['value']
       self.assertEqual(self._event_log_module.GetDataEventName(value), event['event'])
       self.assertTrue(key in config and value == config[key])