def flexint(v):
    """Convert strings to integer values.

    The block read/write commands accept integer values as either
    decimal or hexadecimal. This function converts either format into
    integer values."""
    if isinstance(v, int):
        return v
    else:
        return int(v, 0)
