Check if I am in the Admin Panel (wp-admin)?

I want to have my plugin check if the user is anywhere in the Admin Panel (wp-admin) before executing a script. This would include:


Similar to using the using the global $pagenow:

global $pagenow;
if ( $pagenow == 'upload.php' ) {
    # do something if in the Media page

From doing some research, it looks like the get_current_screen() function is something I need, but this is what I’ve come up which doesn’t work:

global $my_admin_page;
$screen = get_current_screen();
if ( $screen->id = $my_admin_page ) {
    return $content;

Solutions Collecting From Web of "Check if I am in the Admin Panel (wp-admin)?"