Bibliography formatting question (output style)

My bibliography includes books that belong to different series. Some have a volume number within their series whereas others don’t. In the bibliography I want the series title ad the volume to appear together in parentheses, e.g., ‘([series title], [volume number])’. How do I have to define the output style so that (a) the closing parenthesis appears when both a series title and a volume number are present, and also when only the series title is present, but (b) it does not appear when neither a series title nor a volume number are present?

Andreas