def validate_user_access_to_subscribers_helper(user_profile, stream_dict, check_user_subscribed):
 if (user_profile is None):
  raise ValidationError('Missing user to validate access for')
 if (user_profile.realm_id != stream_dict['realm_id']):
  raise ValidationError('Requesting user not in given realm')
 if (user_profile.realm.is_zephyr_mirror_realm and (not stream_dict['invite_only'])):
  raise JsonableError(_('You cannot get subscribers for public streams in this realm'))
 if (stream_dict['invite_only'] and (not check_user_subscribed())):
  raise JsonableError(_('Unable to retrieve subscribers for invite-only stream'))

def validate_user_access_to_subscribers_helper ( user_profile , stream_dict , check_user_subscribed ) : if ( user_profile is None ) : raise ValidationError ( 'Missing user to validate access for' ) if ( user_profile . realm_id != stream_dict [ 'realm_id' ] ) : raise ValidationError ( 'Requesting user not in given realm' ) if ( user_profile . realm . is_zephyr_mirror_realm and ( not stream_dict [ 'invite_only' ] ) ) : raise JsonableError ( _ ( 'You cannot get subscribers for public streams in this realm' ) ) if ( stream_dict [ 'invite_only' ] and ( not check_user_subscribed ( ) ) ) : raise JsonableError ( _ ( 'Unable to retrieve subscribers for invite-only stream' ) )
helper for validate_user_access_to_subscribers that doesnt require a full stream object * check_user_subscribed is a function that when called with no arguments .