def parse_link_header(instr):
 out = {}
 if (not instr):
  return out
 for link in [h.strip() for h in link_splitter.findall(instr)]:
  (url, params) = link.split('>', 1)
  url = url[1:]
  param_dict = {}
  for param in _splitstring(params, PARAMETER, '\\s*;\\s*'):
   try:
    (a, v) = param.split('=', 1)
    param_dict[a.lower()] = _unquotestring(v)
   except ValueError:
    param_dict[param.lower()] = None
  out[url] = param_dict
 return out

def parse_link_header ( instr ) : out = { } if ( not instr ) : return out for link in [ h . strip ( ) for h in link_splitter . findall ( instr ) ] : ( url , params ) = link . split ( '>' , 1 ) url = url [ 1 : ] param_dict = { } for param in _splitstring ( params , PARAMETER , '\\s*;\\s*' ) : try : ( a , v ) = param . split ( '=' , 1 ) param_dict [ a . lower ( ) ] = _unquotestring ( v ) except ValueError : param_dict [ param . lower ( ) ] = None out [ url ] = param_dict return out
given a link-value .