<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_settings_from_profile(profile, profile_dir=None):
 # type: (str, Any)->str """"Returns the configuration file path for the given profile. :param profile: Profile name to be used. :param profile_dir: The directory where the profile configuration file should reside. It may be also a module, and then the directory of the module is used. :return: Configuration file path. """

    if profile_dir is None:
        import settings
        profile_dir = settings

    if hasattr(profile_dir, '__file__'):
        profile_dir = os.path.dirname(profile_dir.__file__)

    return os.path.join(profile_dir, '{0}.cfg'.format(profile))