def xkcd_info(xkcd_id, url=False):
 request = requests.get((('http://www.xkcd.com/' + xkcd_id) + '/info.0.json'))
 data = request.json()
 date = '{} {} {}'.format(data['day'], months[int(data['month'])], data['year'])
 if url:
  url = (' | http://xkcd.com/' + xkcd_id.replace('/', ''))
 return 'xkcd: \x02{}\x02 ({}){}'.format(data['title'], date, (url if url else ''))

def xkcd_info ( xkcd_id , url = False ) : request = requests . get ( ( ( 'http://www.xkcd.com/' + xkcd_id ) + '/info.0.json' ) ) data = request . json ( ) date = '{} {} {}' . format ( data [ 'day' ] , months [ int ( data [ 'month' ] ) ] , data [ 'year' ] ) if url : url = ( ' | http://xkcd.com/' + xkcd_id . replace ( '/' , '' ) ) return 'xkcd: \x02{}\x02 ({}){}' . format ( data [ 'title' ] , date , ( url if url else '' ) )
takes an xkcd entry id and returns a formatted string .