<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ReplacePermission(self, permission_link, permission, options=None):
 """Replaces a permission and return it. :param str permission_link: The link to the permission. :param dict permission: :param dict options: The request options for the request. :return: The new Permission. :rtype: dict """

        if options is None:
            options = {}

        CosmosClient.__ValidateResource(permission)
        path = base.GetPathFromLink(permission_link)
        permission_id = base.GetResourceIdOrFullNameFromLink(permission_link)
        return self.Replace(permission,
                            path,
                            'permissions',
                            permission_id,
                            None,
                            options)