def aligned_indices(i, j, spacing):
    """
    Check if two indices are aligned. Two indices are aligned if they
    differ by an Integer*spacing.
    """
    try:
        return int((i - j)/spacing) == (i - j)/spacing
    except TypeError:
        return False