<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _compute_layer_name(is_defined_within_template, arn):
 """ Computes a unique name based on the LayerVersion Arn Format: <Name of the LayerVersion>-<Version of the LayerVersion>-<sha256 of the arn> Parameters is_defined_within_template bool True if the resource is a Ref to a resource otherwise False arn str ARN of the Resource Returns ------- str A unique name that represents the LayerVersion """


        # If the Layer is defined in the template, the arn will represent the LogicalId of the LayerVersion Resource,
        # which does not require creating a name based on the arn.
        if is_defined_within_template:
            return arn

        try:
            _, layer_name, layer_version = arn.rsplit(':', 2)
        except ValueError:
            raise InvalidLayerVersionArn(arn + " is an Invalid Layer Arn.")

        return LayerVersion.LAYER_NAME_DELIMETER.join([layer_name,
                                                       layer_version,
                                                       hashlib.sha256(arn.encode('utf-8')).hexdigest()[0:10]])