Rewrite method for getting transitively related movie ids to be more pythonic.