Create get_scope function to retrieve scope