<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def memory_warning(config, context):
 """Determines when memory usage is nearing it's max."""

    used = psutil.Process(os.getpid()).memory_info().rss / 1048576
    limit = float(context.memory_limit_in_mb)
    p = used / limit

    memory_threshold = config.get('memory_warning_threshold')

    if p >= memory_threshold:
        config['raven_client'].captureMessage(
            'Memory Usage Warning',
            level='warning',
            extra={
                'MemoryLimitInMB': context.memory_limit_in_mb,
                'MemoryUsedInMB': math.floor(used)
            }
        )
    else:
        # nothing to do check back later
        Timer(.5, memory_warning, (config, context)).start()