code: def resolve_state_machine_name(obj, name):
      def attach_prefix(name):
          if SFN_STATE_MACHINE_PREFIX is not None:
              return SFN_STATE_MACHINE_PREFIX + "_" + name
          return name
  
      project = current.get("project_name")
      obj._is_state_machine_name_hashed = False
      if project:
          if name:
              raise MetaflowException(
                  "--name is not supported for @projects. "
                  "Use --branch instead."
              )
          state_machine_name = attach_prefix(current.project_flow_name)
          project_branch = to_bytes(
              ".".join((project, current.branch_name))
          )
          token_prefix = (
              "mfprj-%s"
              % to_unicode(
                  base64.b32encode(sha1(project_branch).digest())
              )[:16]
          )
          is_project = True
          # AWS Step Functions has a limit of 80 chars for state machine names.
          # We truncate the state machine name if the computed name is greater
          # than 60 chars and append a hashed suffix to ensure uniqueness.
          if len(state_machine_name) > 60:
              name_hash = to_unicode(
                  base64.b32encode(
                      sha1(to_bytes(state_machine_name)).digest()
                  )
              )[:16].lower()
              state_machine_name = "%s-%s" % (
                  state_machine_name[:60],
                  name_hash,
              )
              obj._is_state_machine_name_hashed = True
      else:
          if name and VALID_NAME.search(name):
              raise MetaflowException(
                  "Name '%s' contains invalid characters." % name
              )
  
          state_machine_name = attach_prefix(
              name if name else current.flow_name
          )
          token_prefix = state_machine_name
          is_project = False
  
          if len(state_machine_name) > 80:
              msg = (
                  "The full name of the workflow:\n*%s*\nis longer than 80 "
                  "characters.\n\n"
                  "To deploy this workflow to AWS Step Functions, please "
                  "assign a shorter name\nusing the option\n"
                  "*step-functions --name <name> create*."
                  % state_machine_name
              )
              raise StepFunctionsStateMachineNameTooLong(msg)
  
      return state_machine_name, token_prefix.lower(), is_project
  
imports: import base64
  from metaflow._vendor import click
  from hashlib import sha1
  import json
  import re
  from metaflow import current, decorators, parameters, JSONType
  from metaflow.metaflow_config import SERVICE_VERSION_CHECK, SFN_STATE_MACHINE_PREFIX, UI_URL
  from metaflow.exception import MetaflowException, MetaflowInternalError
  from metaflow.package import MetaflowPackage
  from metaflow.plugins.aws.batch.batch_decorator import BatchDecorator
  from metaflow.tagging_util import validate_tags
  from metaflow.util import get_username, to_bytes, to_unicode, version_parse
  from .step_functions import StepFunctions
  from .production_token import load_token, store_token, new_token
label_desc: Use image node_id 5 for calling a global function with example usage: resolve_state_machine_name(obj, name) and returns: state_machine_name,  token_prefix,  is_project, name, unknown