<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ResolveFlats( dem, in_place = False ):
 """Attempts to resolve flats by imposing a local gradient Args: dem (rdarray):
 An elevation model in_place (bool):
 If True, the DEM is modified in place and there is no return; otherwise, a new, altered DEM is returned. Returns: DEM modified such that all flats drain. """

  if type(dem) is not rdarray:
    raise Exception("A richdem.rdarray or numpy.ndarray is required!")

  if not in_place:
    dem = dem.copy()

  _AddAnalysis(dem, "ResolveFlats(dem, in_place={in_place})".format(in_place=in_place))

  demw = dem.wrap()

  _richdem.rdResolveFlatsEpsilon(demw)

  dem.copyFromWrapped(demw)

  if not in_place:
    return dem