> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Python 2 / IronPython: Helpers

> Compute machine codes and compare activation identifiers.

Python 2 / IronPython implementation. [Reviewed source revision](https://github.com/Cryptolens/cryptolens-python/tree/8f38b5a37580f2aba1c9374f581cdc85e251950f).

```python theme={null}
from cryptolens_python2 import Helpers
```

These legacy helpers do not accept a `v` argument. Use the signatures below rather than copying a Python 3 `v=2` call.

<a id="cryptolens_python2.Helpers.GetMachineCode" />

## GetMachineCode

Compute this device's machine code.

```python theme={null}
Helpers.GetMachineCode()
```

### Result

Returns the machine code computed by this implementation.

Operating-system commands or unexpected system information can raise an exception. Handle a failure to compute an identifier before activating.

### Checks

Computes an identifier only. It does not contact the licensing API or verify a license.

### Example

The legacy helper has no version parameter. Use the same identifier when activating and comparing the returned license.

```python theme={null}
machine_code = Helpers.GetMachineCode()
print(machine_code)
```

<a id="cryptolens_python2.Helpers.IsOnRightMachine" />

## IsOnRightMachine

Check whether the license contains the expected device or process identifier.

```python theme={null}
Helpers.IsOnRightMachine(
    license_key,
    is_floating_license=False,
    allow_overdraft=False,
    custom_machine_code=None
)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `license_key` | Required | A successfully loaded `LicenseKey` object. |
| `is_floating_license` | `False` | Use the floating-activation form of the machine-code comparison. |
| `allow_overdraft` | `False` | Also accept the overdraft form of a floating activation. This does not enable overdraft on the server. |
| `custom_machine_code` | `None` | The identifier already used for activation; supplying it skips local machine-code generation. |

### Result

Returns `True` when an activation matches, otherwise `False`. In floating mode, this implementation expects exactly one returned activation.

A missing license object or a failure while computing its machine code can raise an exception. Check that license loading or activation succeeded first.

### Checks

Compares the identifier using the legacy floating/overdraft format when requested. It does not verify the signature, expiry or floating deadline. Machine checks require **Maximum Number of Machines greater than 0**.

## FAQ

<AccordionGroup>
  <Accordion title="Can I Pass v=2 to the Legacy Machine Helpers?" id="can-i-pass-v2-to-the-legacy-machine-helpers">
    No. Neither `GetMachineCode` nor `IsOnRightMachine` in this implementation has a `v` parameter. You can supply an identifier to `IsOnRightMachine` through `custom_machine_code`; activate with the same value.
  </Accordion>

  <Accordion title="Can I Use a Custom ID for a Floating Process?" id="can-i-use-a-custom-id-for-a-floating-process">
    Yes. Pass your process ID as `machine_code` to activation and as `custom_machine_code` to `IsOnRightMachine`, with `is_floating_license=True`. Keep that ID until the process stops. This legacy floating check expects one activation in the returned license.
  </Accordion>
</AccordionGroup>

[Python SDK Reference](/libraries/python-api)
