code: def from_str(cls, tag_str: str) -> "Tag":
      if ":" not in tag_str:
          return cls(tag_str, None)
      try:
          name, _, version = tag_str.partition(":")
          if not version:
              # in case users mistakenly define "bento:"
              raise BentoMLException(
                  f"{tag_str} contains trailing ':'. Maybe you meant to use `{tag_str}:latest`?"
              )
          return cls(name, version)
      except ValueError:
          raise BentoMLException(f"Invalid {cls.__name__} {tag_str}")
  
imports: import base64
  import logging
  import re
  import typing
  import uuid
  import attr
  import fs
  from ..exceptions import BentoMLException
  from .utils import bentoml_cattr
label_desc: Use image node_id 8 for calling the Tag obj's underlying member method code with example usage: obj.from_str(cls, tag_str) and returns: cls, cls