def extract_name_from_job_arn(arn):
    """Returns the name used in the API given a full ARN for a training job or
    hyperparameter tuning job.

    Args:
        arn:
    """
    slash_pos = arn.find("/")
    if slash_pos == -1:
        raise ValueError("Cannot parse invalid ARN: %s" % arn)
    return arn[(slash_pos + 1) :]