def apply_headers_to_request(req, headers):
    'Apply a headers to a urllib request object '
    if ((headers is not None) and (req is not None)):
        for key in headers:
            value = headers[key]
            if ((value is not None) and (len(value) > 0)):
                req.add_header(key, value)
Apply a headers to a urllib request object
def apply_headers_to_request(req, headers):
    ' '
    if ((headers is not None) and (req is not None)):
        for key in headers:
            value = headers[key]
            if ((value is not None) and (len(value) > 0)):
                req.add_header(key, value)