r.code = code
r.msg = msg
return r

def http_error_416(self, req, fp, code, msg, hdrs):
    raise URLError('Requested Range Not Satisfiable')
opener = urllib.request.build_opener(HTTPRangeHandler)
urllib.request.install_opener(opener)
rangeheader = {'Range': 'bytes=-128'}
req = urllib.request.Request('http://path/to/your/file.mp3', headers=rangeheader)
res = urllib.request.urlopen(req)
res.read()
Fetch only the last 128 bytes of an mp3 file over a http connection