from typing import List


def _get_type_from_dimensions(dimensions: List[int]):
  """Return a bits or nested bit array type with 'dimensions' dimensions."""
  bits_type = 'bits'
  for dim in dimensions:
    bits_type += f'[{dim}]'
  return bits_type