library Address {

  // Default hash for EOA accounts returned by extcodehash
  bytes32 constant internal ACCOUNT_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;

  /**
   * Returns whether the target address is a contract
   * @dev This function will return false if invoked during the constructor of a contract.
   * @param _address address of the account to check
   * @return Whether the target address is a contract
   */
  function isContract(address _address) internal view returns (bool) {
    bytes32 codehash;

    // Currently there is no better way to check if there is a contract in an address
    // than to check the size of the code at that address or if it has a non-zero code hash or account hash
    assembly { codehash := extcodehash(_address) }
    return (codehash != 0x0 && codehash != ACCOUNT_HASH);
  }
}
/**
 * Utility library of inline functions on addresses
 */
function isContract(address _address) internal view returns (bool) {
  bytes32 codehash;

  // Currently there is no better way to check if there is a contract in an address
  // than to check the size of the code at that address or if it has a non-zero code hash or account hash
  assembly { codehash := extcodehash(_address) }
  return (codehash != 0x0 && codehash != ACCOUNT_HASH);
}

/**
 * Returns whether the target address is a contract
 * @dev This function will return false if invoked during the constructor of a contract.
 * @param _address address of the account to check
 * @return Whether the target address is a contract
 */