def get_offset(num, columns, spacing):
    """Return offset from prototype position.
    Positional arguments:
    num -- the number of the object, starting from 0
    columns -- how many columns before wrapping
    spacing -- a tuple of (x,y), spacing between objects
    """
    x_offset = (num % columns) * spacing[0] # x-spacing
    y_offset = (num // columns) * spacing[1] # y-spacing
    return (x_offset, y_offset)