Display tags that only appear in one category

This loop starts by fetching all posts in given category. then goes through each tag of current post, fetches the posts for each tag, and if all of the posts have 0 or 1 category, prints that category. So, if you have lots of tags, lots of posts, this could be slow-ish.

function wa_60126_pl8_artist_list($catname) {

  //this part fetches the posts in the category provided
  $custom_query = new WP_Query('posts_per_page=-1&category_name=".$catname );
  if ($custom_query->have_posts()) :
      while ($custom_query->have_posts()) : $custom_query->the_post();


  $posttags = get_the_tags();

  // build the tag list
  if ($posttags) {
      foreach($posttags as $posttag) {

          // fetch the posts with same tags
          $posts_same_tag = get_posts( array ( "tag' => $posttag->name ) );
          $is_safetag = TRUE;
          // check if has only one category
          foreach( $posts_same_tag as $st_post ) {
          // if it has more than one category, this tag is no good
              if ( count ( wp_get_post_categories($st_post->ID)) > 1 ){
                  $is_safetag = FALSE; break;
              }
          }
          // end of posts and its dirty?
          if($is_safetag) $safetags[] = $posttag;
      }
  }
  endwhile;
  wp_reset_postdata(); // reset the query
  endif;
  // now lets echo the safetags
  foreach( $safetags as $tag) {
        echo '<h2>' . $tag->name . '</h2>';
        echo '<p>' . $tag->description . '</p>';
        echo '<p><a href="http://beatexplorers.com/artist/'. $tag->slug . '">Read posts about ' . $tag->name . '</a></p>';
  }

}