code: def append_md5_if_too_long(component, size):
          
  
          if len(component) > size:
              if size > 32:
                  component_size = size - 32 - 1
                  return "%s_%s" % (component[:component_size],
                                    hashlib.md5(component.encode('utf-8')).hexdigest())
              else:
                  return hashlib.md5(component.encode('utf-8')).hexdigest()[:size]
          else:
              return component
docs: Trims the component if it is longer than size and appends the
          component's md5. Total must be of length size.
  
          :param str component: component to work on
          :param int size: component's size limit
          :return str: component and appended md5 trimmed to be of length size