<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def post_has_mime_parts(request, parts):
 """Validate that a MMP POST contains all required sections. :param request: Django Request :return: None or raises exception. Where information is stored in the request: part_type header: request.META['HTTP_<UPPER CASE NAME>'] part_type file: request.FILES['<name>'] part_type field: request.POST['<name>'] """

    missing = []

    for part_type, part_name in parts:
        if part_type == 'header':
            if 'HTTP_' + part_name.upper() not in request.META:
                missing.append('{}: {}'.format(part_type, part_name))
        elif part_type == 'file':
            if part_name not in list(request.FILES.keys()):
                missing.append('{}: {}'.format(part_type, part_name))
        elif part_type == 'field':
            if part_name not in list(request.POST.keys()):
                missing.append('{}: {}'.format(part_type, part_name))
        else:
            raise d1_common.types.exceptions.ServiceFailure(
                0, 'Invalid part_type. part_type="{}"'.format(part_type)
            )

    if len(missing) > 0:
        raise d1_common.types.exceptions.InvalidRequest(
            0,
            'Missing part(s) in MIME Multipart document. missing="{}"'.format(
                ', '.join(missing)
            ),
        )