<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def append_md5_if_too_long(component, size):
 """ 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 """


        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