So, patch looks good to me. Implements described functionality. Test casealso provided.I think it's ready to be viewed by a committer.
-- Best regards,Maxim Orlov.