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

```
The decorator would be useful for this case and run your blocking function in another thread.

```
import asyncio
from concurrent.futures import ThreadPoolExecutor
from functools import wraps, partial
from typing import Union

class to_async:

    def __init__(self, *, executor: Optional[ThreadPoolExecutor]=None):

        self.executor =  executor

    def __call__(self, blocking):
        @wraps(blocking)
        async def wrapper(*args, **kwargs):

            loop = asyncio.get_event_loop()
            if not self.executor:
                self.executor = ThreadPoolExecutor()

            func = partial(blocking, *args, **kwargs)

            return await loop.run_in_executor(self.executor,func)

        return wrapper

@to_async(executor=None)
def sync(*args, **kwargs):
    print(args, kwargs)

asyncio.run(sync("hello", "world", result=True))

```