code: def compile_validation_pattern(self, units=None):
          
          if units is None:
              units = list(self.POSSIBLE_UNITS)
          else:
              for u in units:
                  if u not in self.POSSIBLE_UNITS:
                      raise ValidationError('{} is not a valid unit for a size field'.format(u))
          regex = re.compile(r'^(-?\d+)({})$'.format('|'.join(units)))
          endings = (' %s ' % ugettext("or")).join("'%s'" % u.replace('%', '%%') for u in units)
          params = {'label': '%(label)s', 'value': '%(value)s', 'field': '%(field)s', 'endings': endings}
          return regex, self.invalid_message % params
docs: Assure that passed in units are valid size units, or if missing, use all possible units.
          Return a tuple with a regular expression to be used for validating and an error message
          in case this validation failed.