def _get_file(src):
 try:
  if (('://' in src) or (src[0:2] == '//')):
   response = urllib2.urlopen(src)
   return response.read()
  else:
   with open(src, 'rb') as fh:
    return fh.read()
 except Exception as e:
  raise RuntimeError('Error generating base64image: {}'.format(e))

def _get_file ( src ) : try : if ( ( '://' in src ) or ( src [ 0 : 2 ] == '//' ) ) : response = urllib2 . urlopen ( src ) return response . read ( ) else : with open ( src , 'rb' ) as fh : return fh . read ( ) except Exception as e : raise RuntimeError ( 'Error generating base64image: {}' . format ( e ) )
return content from local or remote file .