Question: I have a few divs inside a parent section and I'm trying to do an alignment so that the divs are centered within the section. As they are right now, the divs are left aligned. I've tried doing `margin: 0 auto` but that's not working. Can anyone explain how I could accomplish this?

[Pen](http://codepen.io/RobbyT15/pen/xqeoEL)

```css
section {
  margin-bottom: 10px;
  width: 100vw;
  height: 100vh;
}

.notice {
  width: 50vw;
  height: 10vh;
}

section .socialmedia{
    background-color: red;
    width: 100vw;
    height: 15vh;
}
//The divs I'm trying to center
section .icon{
    margin: 0 auto;
    width: 15vw;
    height: 15vh;
    background-color: green;
}
```

```html
<section>
  <div class="notice">
    <h1>Our website is currently undergoing construction, please feel free to contact us on social media.</h1>
  </div>
  <div class="socialmedia">
    <div class="icon"></div>
    <div class="icon"></div>
    <div class="icon"></div>
    <div class="icon"></div>
  </div>
</section>
```

Answer: 
You can use a decorator to wrap the sync version to an async version.

```
import time
from functools import wraps, partial

def wrap(func):
    @wraps(func)
    async def run(*args, loop=None, executor=None, **kwargs):
        if loop is None:
            loop = asyncio.get_event_loop()
        pfunc = partial(func, *args, **kwargs)
        return await loop.run_in_executor(executor, pfunc)
    return run

@wrap
def sleep_async(delay):
    time.sleep(delay)
    return 'I slept asynchronously'

```

**Outdated, aioify is maintenance mode**

or use the [aioify](https://pypi.org/project/aioify/) library

```
% pip install aioify

```

then

```
@aioify
def sleep_async(delay):
    pass

```
From python 3.9 the cleanest way to do this is to use [asyncio.to\_thread](https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread) method, which is basically a shortcut for `run_in_executor`, but keeps all the contextvars.

Also, please consider GIL, since it is a to\_**thread**. You still can run CPU-bound tasks for something like `numpy`. From the docs:

```
Note Due to the GIL, asyncio.to_thread() can typically only be used to make IO-bound functions non-blocking. However, for extension modules that release the GIL or alternative Python implementations that don’t have one, asyncio.to_thread() can also be used for CPU-bound functions.

```