<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_component(filename, default="global"):
 """Get component name from filename."""

    if hasattr(filename, "decode"):
        filename = filename.decode()
    parts = filename.split(os.path.sep)

    if len(parts) >= 3:
        if parts[1] in "modules legacy ext".split():
            return parts[2]
    if len(parts) >= 2:
        if parts[1] in "base celery utils".split():
            return parts[1]
    if len(parts) >= 1:
        if parts[0] in "grunt docs".split():
            return parts[0]
    return default