(post)
return retVal
Finds value for a boundary parameter in given multipart POST body
Finds value for a boundary parameter in given multipart POST body
Finds value for a boundary parameter in given multipart POST body
def findMultipartPostBoundary(post):
    """
    Finds value for a boundary parameter in given multipart POST body
    """

    retVal = None

    done = set()
    candidates = []

    for match in re.finditer(r"(?m)^--(.+?)(--)?$", post or ""):
        _ = match.group(1).strip().strip('-')

        if _ in done:
            continue
        else:
            candidates.append((post.count(_), _))
            done.add(_)

    if candidates:
        candidates.sort(key=lambda _: _[0], reverse=True)
        retVal = candidates[0][1]

    return retVal
def findMultipartPostBoundary ( post ) : retVal = None done = set ( ) candidates = [ ] for match in re . finditer ( r"(?m)^--(.+?)(--)?$" , post or "" ) : _ = match . group ( 1 ) . strip ( ) . strip ( '-' ) if _ in done : continue else : candidates . append ( ( post . count ( _ ) , _ ) ) done . add ( _ ) if candidates : candidates . sort ( key = lambda _ : _ [ 0 ] , reverse = True ) retVal = candidates [ 0 ] [ 1 ] return retVal