input: Write a python function to extract sample from formatted ID tags based on given format.
  assert getSample("sample1_1234_5678") == "1234"
  assert getSample("sample2.9876") == "sample2"
  assert getSample("test_foo_bar.1234") == "foo"
output: def getSample(tag):
      if '_' in tag:
          parts = tag.split('_')
          if parts[0].startswith('sample'):
              return parts[1]
          return parts[1]
      elif '.' in tag:
          return tag.split('.')[0]
      return ""