def get_stack_name(stack_formatted):
  """
  Get the stack name (eg. HDP) from formatted string that may contain stack version (eg. HDP-2.6.1.0-123)
  """
  if stack_formatted is None:
    return None

  if '-' not in stack_formatted:
    return stack_formatted

  return stack_formatted.split('-')[0]