def pre_start_checks(ctx: click.Context, opts: ProxyContext) -> Optional[RemoteAccessConnectionData]:
    'Run prestart checks before starting the local proxy\n\n    Args:\n        ctx (click.Context): Click context\n        opts (ProxyContext): Proxy options\n\n    Returns:\n        Optional[RemoteAccessConnectionData]: Remote access connection data\n    '
    try:
        client = create_client(ctx, opts)
        mor = client.get_managed_object(opts.device, opts.external_type)
        config_id = get_config_id(ctx, mor, opts.config)
        device_id = mor.get('id')
        is_authorized = client.validate_remote_access_role()
        if (not is_authorized):
            opts.show_error(f'The user is not authorized to use Cloud Remote Access. Contact your Cumulocity Admin. user={opts.user}')
            ctx.exit(ExitCodes.MISSING_ROLE_REMOTE_ACCESS_ADMIN)
    except Exception as ex:
        if isinstance(ex, click.exceptions.Exit):
            opts.show_error(f'Could not retrieve device information. reason={ex}')
            raise
        error_context = ''
        extra_details = []
        if (opts.host and (opts.host not in str(ex))):
            extra_details.append(f"host={(opts.host or '')}")
        if (opts.user and (opts.user not in str(ex))):
            extra_details.append(f"user={(opts.user or '')}")
        if extra_details:
            error_context = ('. settings: ' + ', '.join(extra_details))
        opts.show_error(f'Unexpected error when retrieving device information from Cumulocity. error_details={ex}{error_context}')
        ctx.exit(ExitCodes.NOT_AUTHORIZED)
    return RemoteAccessConnectionData(client=client, managed_object_id=device_id, remote_config_id=config_id)
Run prestart checks before starting the local proxy

Args:
    ctx (click.Context): Click context
    opts (ProxyContext): Proxy options

Returns:
    Optional[RemoteAccessConnectionData]: Remote access connection data
def pre_start_checks(ctx: click.Context, opts: ProxyContext) -> Optional[RemoteAccessConnectionData]:
    'Run prestart checks before starting the local proxy\n\n    Args:\n        ctx (click.Context): Click context\n        opts (ProxyContext): Proxy options\n\n    Returns:\n        Optional[RemoteAccessConnectionData]: Remote access connection data\n    '
    try:
        client = create_client(ctx, opts)
        mor = client.get_managed_object(opts.device, opts.external_type)
        config_id = get_config_id(ctx, mor, opts.config)
        device_id = mor.get('id')
        is_authorized = client.validate_remote_access_role()
        if (not is_authorized):
            opts.show_error(f'The user is not authorized to use Cloud Remote Access. Contact your Cumulocity Admin. user={opts.user}')
            ctx.exit(ExitCodes.MISSING_ROLE_REMOTE_ACCESS_ADMIN)
    except Exception as ex:
        if isinstance(ex, click.exceptions.Exit):
            opts.show_error(f'Could not retrieve device information. reason={ex}')
            raise
        error_context = 
        extra_details = []
        if (opts.host and (opts.host not in str(ex))):
            extra_details.append(f"host={(opts.host or )}")
        if (opts.user and (opts.user not in str(ex))):
            extra_details.append(f"user={(opts.user or )}")
        if extra_details:
            error_context = ('. settings: ' + ', '.join(extra_details))
        opts.show_error(f'Unexpected error when retrieving device information from Cumulocity. error_details={ex}{error_context}')
        ctx.exit(ExitCodes.NOT_AUTHORIZED)
    return RemoteAccessConnectionData(client=client, managed_object_id=device_id, remote_config_id=config_id)