def pyname(ifmain=False):
    """
    Get the value of __name__

    :type ifmain: boolean
    :param ifmain: If set to True then True will be returned if __name__ is equal to __main__

    :return: The value of __name__ or if ifmain is True, then if __name__ is equal to __main__
    :rtype: string or boolean
    """

    if ifmain is True:
        return __name__ == "__main__"
    return __name__