def claim_vm(cmd, client, lab_name=None, name=None, resource_group_name=None):
    """ Command to claim a VM in the Azure DevTest Lab"""
    if name is not None:
        return client.claim(resource_group_name, lab_name, name)
    from ._client_factory import get_devtestlabs_lab_operation
    return get_devtestlabs_lab_operation(cmd.cli_ctx, None).claim_any_vm(
        resource_group_name, lab_name)
