def METHOD_NAME(
    self, raw: str, qualifier: Optional[str] = None
) -> Dict[str, Any]:
    policy = json.loads(raw, object_hook=self.decode_policy)
    if len(policy.revision) > 0 and self.revision != policy.revision:
        raise PreconditionFailedException(
            "The RevisionId provided does not match the latest RevisionId"
            " for the Lambda function or alias. Call the GetFunction or the GetAlias API to retrieve"
            " the latest RevisionId for your resource."
        )
    # Remove #LATEST from the Resource (Lambda ARN)
    if policy.statements[0].get("Resource", "").endswith("$LATEST"):
        policy.statements[0]["Resource"] = policy.statements[0]["Resource"][0:-8]
    if qualifier:
        policy.statements[0]["Resource"] = (
            policy.statements[0]["Resource"] + ":" + qualifier
        )
    self.statements.append(policy.statements[0])
    self.revision = str(mock_random.uuid4())
    return policy.statements[0]