#NEWLINE# def _hadoop_prefix_from_bin( hadoop_bin ) : #NEWLINE# #INDENT# "Given a path to the hadoop binary, return the path of the implied\n    hadoop home, or None if we don't know.\n\n    Don't return the parent directory of directories in the default\n    path (not ``/``, ``/usr``, or ``/usr/local``).\n    " #NEWLINE# if ( '/' not in hadoop_bin ) : #NEWLINE# #INDENT# hadoop_bin = which ( hadoop_bin ) #NEWLINE# if ( not hadoop_bin ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# hadoop_home = posixpath . abspath ( posixpath . join ( posixpath . realpath ( posixpath . dirname ( hadoop_home ) ) , '..' ) ) #NEWLINE# if ( hadoop_home in _BAD_HADOOP_HOMES ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# return hadoop_home