<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _all_dims(x, default_dims=None):
 """Returns a list of dims in x or default_dims if the rank is unknown."""

  if x.get_shape().ndims is not None:
    return list(xrange(x.get_shape().ndims))
  else:
    return default_dims